【发布时间】:2021-03-08 20:26:21
【问题描述】:
我正在关注本教程,在本地 MacOS 上运行 az cli(v 2.11): https://docs.microsoft.com/en-us/learn/modules/provision-infrastructure-azure-pipelines/6-run-terraform-remote-storage
在执行了包括这个在内的几个步骤之后:
az storage account create --name tfsa$UNIQUE_ID --resource-group tf-storage-rg --sku Standard_LRS
并已运行此命令:
az storage container list --query "[].{name:name}" --output tsv
我收到以下信息:
HTTPSConnectionPool(host='mystorageaccount20822.blob.core.windows.net', port=443): Max retries exceeded with url: /?comp=list&maxresults=5000 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10d2566a0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
上述命令在云 shell 中工作,但在我的本地 shell 中失败(运行 v 2.20,最新)
在云壳上我做得到这个警告:
您的命令和环境中没有提供凭据,我们 将查询存储帐户中的帐户密钥。请 提供 --connection-string、--account-key 或 --sas-token 作为 凭据,或者如果您需要 RBAC,请使用
--auth-mode login你的命令中的角色。有关 RBAC 角色的更多信息,请参见 存储,访问 https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-rbac-cli.
我之前在几周前创建了一个 mystorageaccount20822 但将其删除...我的 AZ CLI 仍绑定到这个以前的帐户?有没有办法告诉我的 az cli(在 mac 上)与我正在运行的当前资源同步。在 Azure 门户中 mystorageaccount20822 不存在。
Azure CLI 是否缓存某些值或其他内容?是否有一些隐藏的配置文件设置了旧的 'mystorageaccount20822' 并且 CLI 每次都尝试引用它而不是名为 tfsa$UNIQUE_ID 的新帐户?
【问题讨论】:
-
您是否尝试在创建存储帐户后立即列出容器?
-
@GauravMantri,是的,我已经按照教程一步一步地学习了......奇怪的是它在 Azure Cloud Shell 中工作......但如果我尝试在我的本地运行命令shell 它会产生该错误.. 更新了有问题的描述
标签: azure