You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过脚本设置Azure Storage的defaultToOAuthAuthentication属性

通过Azure CLI设置存储账户的defaultToOAuthAuthentication属性

可以通过Azure CLI脚本完成该属性的设置,支持创建存储账户时配置和修改已有存储账户两种场景,具体命令如下:

1. 创建存储账户时启用该属性

使用az storage account create命令,添加--default-to-oauth-authentication true参数即可在创建时直接开启默认OAuth认证:

az storage account create \
  --name <你的存储账户名称> \
  --resource-group <你的资源组名称> \
  --location <区域名称> \
  --sku Standard_LRS \
  --default-to-oauth-authentication true

2. 修改已存在的存储账户

如果存储账户已创建,使用az storage account update命令更新该属性:

az storage account update \
  --name <你的存储账户名称> \
  --resource-group <你的资源组名称> \
  --default-to-oauth-authentication true

注意事项

  • 确保你的Azure CLI是最新版本,若版本过旧可能不支持该参数,可执行az upgrade命令更新CLI。
  • 设置该属性后,后续新建的存储容器会默认使用Azure AD授权进行数据操作,和Azure门户设置的效果一致。

内容的提问来源于stack exchange,提问作者orange-lily

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 01:02:03