使用自定义映像(来自 Centos 7 基础映像)部署了适用于容器的 Azure 应用服务。基于以下文档有一个环境变量应由 Azure 设置并用于创建 REST API 请求以获取访问令牌:
但是,在检查容器内部时,未设置此变量:
[root@f22dfd74be31 ~]# echo $IDENTITY_ENDPOINT
(empty result here)
Run Code Online (Sandbox Code Playgroud)
我还尝试调用 az cli,但也失败了:
[root@f22dfd74be31 ~]# az login -i
AzureConnectionError: Failed to connect to MSI. Please make sure MSI is configured correctly
and check the network connection.
Error detail: HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with
url: /metadata/identity/oauth2/token?resource=https%3
A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01 (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9e0c4
c72e8>: Failed to establish a new connection: [Errno 110] Connection timed out',)) …
Run Code Online (Sandbox Code Playgroud) azure azure-web-app-service azure-web-app-for-containers azure-appservice