AzureResponseError:操作返回了无效的状态代码“未授权”

问题描述

我已将我的应用从 GitHub 克隆到 Azure shell。当我尝试创建和部署 webapp 时,我遇到了一些错误。首先,我尝试了 az webapp up -n newappname,但出现以下错误

enter image description here

然后我自己在门户中创建了一个 Web 应用程序,并尝试使用命令 az webapp up -n newappname_createdatportal 从 Azure shell 部署它。我收到以下错误

enter image description here

这里的任何建议将不胜感激!

解决方法

这似乎是旧 Azure CLI 版本的错误,运行 az upgrade --yes 并重新启动您的提示为我解决问题。

需要注意以下几点:

  1. 我的 Azure CLI 版本:2.18.0

  2. 我使用的命令:

    az upgrade --yes
    #restart session and run this for authorizing
    az login 
    az webapp up -n webappnamecreated
    

这是重现屏幕截图: enter image description here

成功截图如下: enter image description here

,

我尝试按照其他答案的建议更新 PUT my-index-000001 { "mappings": { "properties": { "my_field": { "type": "search_as_you_type" } } } } { "error": { "root_cause": [ { "type": "mapper_parsing_exception","reason": "No handler for type [search_as_you_type] declared on field [my_field]" } ],"type": "mapper_parsing_exception","reason": "Failed to parse mapping [_doc]: No handler for type [search_as_you_type] declared on field [my_field]","caused_by": { "type": "mapper_parsing_exception","reason": "No handler for type [search_as_you_type] declared on field [my_field]" } },"status": 400 } 命令行,但对我不起作用。

先尝试创建一个应用程序名称为 az 的应用服务计划,而不是执行 az webapp up -n appname,然后只有在部署后才输入命令 appname。这对我有用。