az cosmosdb sql role assignment

Manage Azure Cosmos DB SQL role assignments.

命令

名稱 Description 類型 狀態
az cosmosdb sql role assignment create

喺 Azure Cosmos DB 帳戶下建立一個 SQL 角色分配。

Core GA
az cosmosdb sql role assignment delete

Delete a SQL role assignment under an Azure Cosmos DB account.

Core GA
az cosmosdb sql role assignment exists

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

Core GA
az cosmosdb sql role assignment list

列出所有 SQL 角色分配,歸屬於 Azure Cosmos DB 帳戶。

Core GA
az cosmosdb sql role assignment show

顯示 Azure Cosmos DB 帳戶下 SQL 角色分配的屬性。

Core GA
az cosmosdb sql role assignment update

Update a SQL role assignment under an Azure Cosmos DB account.

Core GA
az cosmosdb sql role assignment wait

輪詢 SQL 角色指派,直到符合特定條件為止。

Core GA

az cosmosdb sql role assignment create

喺 Azure Cosmos DB 帳戶下建立一個 SQL 角色分配。

az cosmosdb sql role assignment create --account-name
                                       --principal-id
                                       --resource-group
                                       --scope
                                       [--acquire-policy-token]
                                       [--change-reference]
                                       [--no-wait]
                                       [--role-assignment-id]
                                       [--role-definition-id]
                                       [--role-definition-name]

範例

在 Azure Cosmos DB 帳戶下使用 Role Definition Name 建立 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

在 Azure Cosmos DB 帳戶下使用 Role Definition ID 建立 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 物件標識碼。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--scope -s

要授與此角色指派的數據平面資源路徑。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--acquire-policy-token

自動取得 Azure 原則 令牌以進行此資源操作。

屬性
參數群組: Global Policy Arguments
--change-reference

相關變更的 ID 是為此資源操作所參考的。

屬性
參數群組: Global Policy Arguments
--no-wait

請勿等候長時間執行的作業完成。

屬性
預設值: False
--role-assignment-id -i

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

--role-definition-id -d

此角色指派所參考之角色定義的唯一標識符。

--role-definition-name -n

此角色指派所參考之角色定義的唯一名稱。 Eg. 'Contoso 讀者角色'。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az cosmosdb sql role assignment delete

Delete a SQL role assignment under an Azure Cosmos DB account.

az cosmosdb sql role assignment delete --account-name
                                       --resource-group
                                       --role-assignment-id
                                       [--acquire-policy-token]
                                       [--change-reference]
                                       [--no-wait]
                                       [--yes]

範例

Delete a SQL role assignment under an Azure Cosmos DB account.

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

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--acquire-policy-token

自動取得 Azure 原則 令牌以進行此資源操作。

屬性
參數群組: Global Policy Arguments
--change-reference

相關變更的 ID 是為此資源操作所參考的。

屬性
參數群組: Global Policy Arguments
--no-wait

請勿等候長時間執行的作業完成。

屬性
預設值: False
--yes -y

請勿提示確認。

屬性
預設值: False
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az cosmosdb sql role assignment exists

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

az cosmosdb sql role assignment exists --account-name
                                       --resource-group
                                       --role-assignment-id
                                       [--acquire-policy-token]
                                       [--change-reference]

範例

檢查是否有 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

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--acquire-policy-token

自動取得 Azure 原則 令牌以進行此資源操作。

屬性
參數群組: Global Policy Arguments
--change-reference

相關變更的 ID 是為此資源操作所參考的。

屬性
參數群組: Global Policy Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az cosmosdb sql role assignment list

列出所有 SQL 角色分配,歸屬於 Azure Cosmos DB 帳戶。

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

範例

列出所有 SQL 角色分配,歸屬於 Azure Cosmos DB 帳戶。

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

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

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

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az cosmosdb sql role assignment update

Update a SQL role assignment under an Azure Cosmos DB account.

az cosmosdb sql role assignment update --account-name
                                       --resource-group
                                       --role-assignment-id
                                       [--acquire-policy-token]
                                       [--change-reference]
                                       [--no-wait]
                                       [--principal-id]
                                       [--role-definition-id]
                                       [--role-definition-name]
                                       [--scope]

範例

Update a SQL role assignment under an Azure Cosmos DB account.

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

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--acquire-policy-token

自動取得 Azure 原則 令牌以進行此資源操作。

屬性
參數群組: Global Policy Arguments
--change-reference

相關變更的 ID 是為此資源操作所參考的。

屬性
參數群組: Global Policy Arguments
--no-wait

請勿等候長時間執行的作業完成。

屬性
預設值: False
--principal-id -p

要授與此角色指派之主體的 AAD 物件標識碼。

--role-definition-id -d

此角色指派所參考之角色定義的唯一標識符。

--role-definition-name -n

此角色指派所參考之角色定義的唯一名稱。 Eg. 'Contoso 讀者角色'。

--scope -s

要授與此角色指派的數據平面資源路徑。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az cosmosdb sql role assignment wait

輪詢 SQL 角色指派,直到符合特定條件為止。

az cosmosdb sql role assignment wait --account-name
                                     --resource-group
                                     --role-assignment-id
                                     [--acquire-policy-token]
                                     [--change-reference]
                                     [--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

選擇性的 [建立]。 角色指派的唯一標識符。 如果未提供,則會使用新的 GUID。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--acquire-policy-token

自動取得 Azure 原則 令牌以進行此資源操作。

屬性
參數群組: Global Policy Arguments
--change-reference

相關變更的 ID 是為此資源操作所參考的。

屬性
參數群組: Global Policy Arguments
--created

請等候在 'Succeeded' 使用 'provisioningState' 建立。

屬性
參數群組: Wait Condition Arguments
預設值: False
--custom

等到條件符合自定義 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

屬性
參數群組: Wait Condition Arguments
--deleted

等到刪除為止。

屬性
參數群組: Wait Condition Arguments
預設值: False
--exists

等候資源存在。

屬性
參數群組: Wait Condition Arguments
預設值: False
--interval

輪詢間隔以秒為單位。

屬性
參數群組: Wait Condition Arguments
預設值: 30
--timeout

以秒為單位的等候上限。

屬性
參數群組: Wait Condition Arguments
預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

屬性
參數群組: Wait Condition Arguments
預設值: False
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False