你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az cosmosdb sql role assignment

管理 Azure Cosmos DB SQL 角色分配。

命令

名称 说明 类型 状态
az cosmosdb sql role assignment create

在 Azure Cosmos DB 帐户下创建 SQL 角色分配。

核心 GA
az cosmosdb sql role assignment delete

删除 Azure Cosmos DB 帐户下的 SQL 角色分配。

核心 GA
az cosmosdb sql role assignment exists

检查 Azure Cosmos DB 角色分配是否存在。

核心 GA
az cosmosdb sql role assignment list

列出 Azure Cosmos DB 帐户下的所有 SQL 角色分配。

核心 GA
az cosmosdb sql role assignment show

显示 Azure Cosmos DB 帐户下 SQL 角色分配的属性。

核心 GA
az cosmosdb sql role assignment update

在 Azure Cosmos DB 帐户下更新 SQL 角色分配。

核心 GA
az cosmosdb sql role assignment wait

轮询 SQL 角色分配,直到满足特定条件。

核心 GA

az cosmosdb sql role assignment create

在 Azure Cosmos DB 帐户下创建 SQL 角色分配。

az cosmosdb sql role assignment create --account-name
                                       --principal-id
                                       --resource-group
                                       --scope
                                       [--no-wait]
                                       [--role-assignment-id]
                                       [--role-definition-id]
                                       [--role-definition-name]

示例

使用角色定义名称在 Azure Cosmos DB 帐户下创建 SQL 角色分配。

az cosmosdb sql role assignment create --account-name MyAccount --resource-group MyResourceGroup \
  --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8 \
  --role-definition-name "My Read Only Role" \
  --scope "/dbs/mydb/colls/mycontainer" \
  --principal-id 6328f5f7-dbf7-4244-bba8-fbb9d8066506

使用角色定义 ID 在 Azure Cosmos DB 帐户下创建 SQL 角色分配。

az cosmosdb sql role assignment create --account-name MyAccount --resource-group MyResourceGroup \
  --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8 \
  --role-definition-id be79875a-2cc4-40d5-8958-566017875b39 \
  --scope "/dbs/mydb/colls/mycontainer" \
  --principal-id 6328f5f7-dbf7-4244-bba8-fbb9d8066506

必需参数

--account-name -a

Cosmosdb 帐户名称。

--principal-id -p

要向其授予此角色分配的主体的 AAD 对象 ID。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--scope -s

要向其授予此角色分配的数据平面资源路径。

可选参数

--no-wait

不等待长时间运行的操作完成。

默认值: False
--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

--role-definition-id -d

此角色分配引用的角色定义的唯一 ID。

--role-definition-name -n

此角色分配引用的角色定义的唯一名称。 例如 “Contoso 读者角色”。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment delete

删除 Azure Cosmos DB 帐户下的 SQL 角色分配。

az cosmosdb sql role assignment delete --account-name
                                       --resource-group
                                       --role-assignment-id
                                       [--no-wait]
                                       [--yes]

示例

删除 Azure Cosmos DB 帐户下的 SQL 角色分配。

az cosmosdb sql role assignment delete --account-name MyAccount --resource-group MyResourceGroup --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

可选参数

--no-wait

不等待长时间运行的操作完成。

默认值: False
--yes -y

不提示确认。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment exists

检查 Azure Cosmos DB 角色分配是否存在。

az cosmosdb sql role assignment exists --account-name
                                       --resource-group
                                       --role-assignment-id

示例

检查 Azure Cosmos DB 角色分配是否存在。

az cosmosdb sql role assignment exists --account-name MyAccount --resource-group MyResourceGroup --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment list

列出 Azure Cosmos DB 帐户下的所有 SQL 角色分配。

az cosmosdb sql role assignment list --account-name
                                     --resource-group

示例

列出 Azure Cosmos DB 帐户下的所有 SQL 角色分配。

az cosmosdb sql role assignment list --account-name MyAccount --resource-group MyResourceGroup

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment show

显示 Azure Cosmos DB 帐户下 SQL 角色分配的属性。

az cosmosdb sql role assignment show --account-name
                                     --resource-group
                                     --role-assignment-id

示例

显示 Azure Cosmos DB 帐户下 SQL 角色分配的属性。

az cosmosdb sql role assignment show --account-name MyAccount --resource-group MyResourceGroup --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment update

在 Azure Cosmos DB 帐户下更新 SQL 角色分配。

az cosmosdb sql role assignment update --account-name
                                       --resource-group
                                       --role-assignment-id
                                       [--no-wait]
                                       [--principal-id]
                                       [--role-definition-id]
                                       [--role-definition-name]
                                       [--scope]

示例

在 Azure Cosmos DB 帐户下更新 SQL 角色分配。

az cosmosdb sql role assignment update --account-name MyAccount --resource-group MyResourceGroup \
  --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8 \
  --role-definition-id updated-role-definition-id

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

可选参数

--no-wait

不等待长时间运行的操作完成。

默认值: False
--principal-id -p

要向其授予此角色分配的主体的 AAD 对象 ID。

--role-definition-id -d

此角色分配引用的角色定义的唯一 ID。

--role-definition-name -n

此角色分配引用的角色定义的唯一名称。 例如 “Contoso 读者角色”。

--scope -s

要向其授予此角色分配的数据平面资源路径。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az cosmosdb sql role assignment wait

轮询 SQL 角色分配,直到满足特定条件。

az cosmosdb sql role assignment wait --account-name
                                     --resource-group
                                     --role-assignment-id
                                     [--created]
                                     [--custom]
                                     [--deleted]
                                     [--exists]
                                     [--interval]
                                     [--timeout]
                                     [--updated]

示例

轮询 SQL 角色分配,直到删除它。

az cosmosdb sql role assignment wait --account-name MyAccount --resource-group MyResourceGroup --role-assignment-id cb8ed2d7-2371-4e3c-bd31-6cc1560e84f8 --deleted

必需参数

--account-name -a

Cosmosdb 帐户名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--role-assignment-id -i

“创建”可选。 角色分配的唯一 ID。 如果未提供,将使用新的 GUID。

可选参数

--created

等待在“Succeeded”中使用“provisioningState”创建。

默认值: False
--custom

等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到删除为止。

默认值: False
--exists

等待资源存在。

默认值: False
--interval

轮询间隔(以秒为单位)。

默认值: 30
--timeout

最大等待(以秒为单位)。

默认值: 3600
--updated

等到 provisioningState 更新为“Succeeded”。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。