Share via


az cosmosdb sql role definition

管理 Azure Cosmos DB SQL 角色定義。

命令

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

在 Azure Cosmos DB 帳戶下建立 SQL 角色定義。

核心 GA
az cosmosdb sql role definition delete

刪除 Azure Cosmos DB 帳戶下的 SQL 角色定義。

核心 GA
az cosmosdb sql role definition exists

檢查 Azure Cosmos DB 角色定義是否存在。

核心 GA
az cosmosdb sql role definition list

列出 Azure Cosmos DB 帳戶下的所有 SQL 角色定義。

核心 GA
az cosmosdb sql role definition show

顯示 Azure Cosmos DB 帳戶下 SQL 角色定義的屬性。

核心 GA
az cosmosdb sql role definition update

更新 Azure Cosmos DB 帳戶下的 SQL 角色定義。

核心 GA
az cosmosdb sql role definition wait

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

核心 GA

az cosmosdb sql role definition create

在 Azure Cosmos DB 帳戶下建立 SQL 角色定義。

az cosmosdb sql role definition create --account-name
                                       --body
                                       --resource-group
                                       [--no-wait]

範例

使用 JSON 字串,在 Azure Cosmos DB 帳戶下建立 SQL 角色定義。

az cosmosdb sql role definition create --account-name MyAccount --resource-group MyResourceGroup --body '{
  "Id": "be79875a-2cc4-40d5-8958-566017875b39",
  "RoleName": "My Read Only Role",
  "Type": "CustomRole",
  "AssignableScopes": ["/dbs/mydb/colls/mycontainer"],
  "Permissions": [{
    "DataActions": [
      "Microsoft.DocumentDB/databaseAccounts/readMetadata",
      "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read",
      "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/executeQuery",
      "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readChangeFeed"
    ]
  }]
}'

使用 JSON 檔案,在 Azure Cosmos DB 帳戶下建立 SQL 角色定義。

az cosmosdb sql role definition create --account-name MyAccount --resource-group MyResourceGroup --body @role-definition.json

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--body -b

具有識別碼的角色定義主體(選擇性用於建立)、DataActions 或許可權、類型(預設值為 CustomRole),以及 AssignableScopes。 您可以將它輸入為字串或檔案,例如 --body 或 --body @rdbody-file.json 「{ 」Id「: 」be79875a-2cc4-40d5-8958-566017875b39「, 」RoleName「: 」My Read Write Role「, 」Type「: 」CustomRole「, 」AssignableScopes「: [ 」/「 ], 」DataActions「: [ 」Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create「, 」Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read「 ]}」。

--resource-group -g

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

選擇性參數

--no-wait

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

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

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

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

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

--subscription

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition delete

刪除 Azure Cosmos DB 帳戶下的 SQL 角色定義。

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

範例

刪除 Azure Cosmos DB 帳戶下的 SQL 角色定義。

az cosmosdb sql role definition delete --account-name MyAccount --resource-group MyResourceGroup --id be79875a-2cc4-40d5-8958-566017875b39

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--id -i

角色定義的唯一識別碼。

--resource-group -g

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

選擇性參數

--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

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition exists

檢查 Azure Cosmos DB 角色定義是否存在。

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

範例

檢查 Azure Cosmos DB 角色定義是否存在。

az cosmosdb sql role definition exists --account-name MyAccount --resource-group MyResourceGroup --id be79875a-2cc4-40d5-8958-566017875b39

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--id -i

角色定義的唯一識別碼。

--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

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition list

列出 Azure Cosmos DB 帳戶下的所有 SQL 角色定義。

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

範例

列出 Azure Cosmos DB 帳戶下的所有 SQL 角色定義。

az cosmosdb sql role definition 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

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition show

顯示 Azure Cosmos DB 帳戶下 SQL 角色定義的屬性。

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

範例

顯示 Azure Cosmos DB 帳戶下 SQL 角色定義的屬性。

az cosmosdb sql role definition show --account-name MyAccount --resource-group MyResourceGroup --id be79875a-2cc4-40d5-8958-566017875b39

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--id -i

角色定義的唯一識別碼。

--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

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition update

更新 Azure Cosmos DB 帳戶下的 SQL 角色定義。

az cosmosdb sql role definition update --account-name
                                       --body
                                       --resource-group
                                       [--no-wait]

範例

更新 Azure Cosmos DB 帳戶下的 SQL 角色定義。

az cosmosdb sql role definition update --account-name MyAccount --resource-group MyResourceGroup --body @role-definition.json

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--body -b

具有識別碼的角色定義主體(選擇性用於建立)、DataActions 或許可權、類型(預設值為 CustomRole),以及 AssignableScopes。 您可以將它輸入為字串或檔案,例如 --body 或 --body @rdbody-file.json 「{ 」Id「: 」be79875a-2cc4-40d5-8958-566017875b39「, 」RoleName「: 」My Read Write Role「, 」Type「: 」CustomRole「, 」AssignableScopes「: [ 」/「 ], 」DataActions「: [ 」Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create「, 」Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read「 ]}」。

--resource-group -g

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

選擇性參數

--no-wait

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

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

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

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

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

--subscription

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb sql role definition wait

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

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

範例

輪詢 SQL 角色定義,直到刪除為止。

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

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--id -i

角色定義的唯一識別碼。

--resource-group -g

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

選擇性參數

--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

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

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。