如何通过Azure CLI启用存储账户的Microsoft Entra默认授权?
使用Azure CLI启用存储账户的“默认使用Microsoft Entra授权”
可以通过Azure CLI完成这个设置,但**az storage account create命令目前没有直接对应该属性的参数**,需要分两步操作:先创建存储账户,再更新配置启用该属性。
步骤1:创建存储账户
先用常规命令创建存储账户(根据你的需求调整参数):
az storage account create \ --name <你的存储账户名> \ --resource-group <你的资源组名> \ --location <区域,比如eastus> \ --sku Standard_LRS
步骤2:启用默认Microsoft Entra授权
创建完成后,使用az storage account update命令修改defaultToOAuth2AuthenticationOnly属性(该属性对应门户中的“默认使用Microsoft Entra授权”):
az storage account update \ --name <你的存储账户名> \ --resource-group <你的资源组名> \ --set defaultToOAuth2AuthenticationOnly=true
验证设置是否生效
执行以下命令查看属性状态,返回true即为启用成功:
az storage account show \ --name <你的存储账户名> \ --resource-group <你的资源组名> \ --query "defaultToOAuth2AuthenticationOnly"
内容的提问来源于stack exchange,提问作者bdcoder
相关产品推荐
相关产品推荐

