Skip to content

Commit 73c1016

Browse files
committed
update
1 parent 9f822d8 commit 73c1016

File tree

1 file changed

+50
-4
lines changed
  • articles/ai-services/openai/how-to

1 file changed

+50
-4
lines changed

articles/ai-services/openai/how-to/quota.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: openai
1010
ms.topic: how-to
11-
ms.date: 07/31/2023
11+
ms.date: 08/01/2023
1212
ms.author: mbullwin
1313
---
1414

@@ -19,7 +19,8 @@ Quota provides the flexibility to actively manage the allocation of rate limits
1919
## Prerequisites
2020

2121
> [!IMPORTANT]
22-
> Quota requires the **Cognitive Services Usages Reader** role. This role provides the minimal access necessary to view quota usage across an Azure subscription. This role can be found in the Azure portal under **Subscriptions** > **Access control (IAM)** > **Add role assignment** > search for **Cognitive Services Usages Reader**.
22+
> Viewing quota and deploying models requires the **Cognitive Services Usages Reader** role. This role provides the minimal access necessary to view quota usage across an Azure subscription. This role can be found in the Azure portal under **Subscriptions** > **Access control (IAM)** > **Add role assignment** > search for **Cognitive Services Usages Reader**.
23+
> This role **must be applied at the subscription level**, it does not exist at the resource level. If you do not wish to use this role alternatively the Subscription **Reader** role will provide equivalent access, but it will also grant read access beyond the scope of what is needed for quota and model deployment.
2324
2425
## Introduction to quota
2526

@@ -106,10 +107,12 @@ To minimize issues related to rate limits, it's a good idea to use the following
106107

107108
## Automate deployment
108109

109-
This section contains brief example templates to help get you started programmatically managing quota, and deploying resources. With the introduction of quota you must use API version `2023-05-01` for resource management related activities. This API version is only for managing your resources, and does not impact the API version used for inferencing calls like completions, chat completions, embedding, image generation etc.
110+
This section contains brief example templates to help get you started programmatically creating deployments that use quota to set TPM rate limits. With the introduction of quota you must use API version `2023-05-01` for resource management related activities. This API version is only for managing your resources, and does not impact the API version used for inferencing calls like completions, chat completions, embedding, image generation etc.
110111

111112
# [REST](#tab/rest)
112113

114+
### Deployment
115+
113116
```http
114117
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}?api-version=2023-05-01
115118
```
@@ -149,6 +152,33 @@ curl -X PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-0
149152
> [!NOTE]
150153
> There are multiple ways to generate an authorization token. The easiest method for initial testing is to launch the Cloud Shell from the [Azure portal](https://portal.azure.com). Then run [`az account get-access-token`](/cli/azure/account?view=azure-cli-latest#az-account-get-access-token&preserve-view=true). You can use this token as your temporary authorization token for API testing.
151154
155+
### Usage
156+
157+
To query your quota usage in a given region, for a specific subscription
158+
159+
```html
160+
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages?api-version=2023-05-01
161+
```
162+
**Path parameters**
163+
164+
| Parameter | Type | Required? | Description |
165+
|--|--|--|--|
166+
| ```subscriptionId``` | string | Required | Subscription ID for the associated subscription. |
167+
|```location``` | string | Required | Location to view usage for ex: `eastus` |
168+
| ```api-version``` | string | Required |The API version to use for this operation. This follows the YYYY-MM-DD format. |
169+
170+
**Supported versions**
171+
172+
- `2023-05-01` [Swagger spec](https://github.com/Azure/azure-rest-api-specs/blob/1e71ad94aeb8843559d59d863c895770560d7c93/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/cognitiveservices.json)
173+
174+
#### Example request
175+
176+
```Bash
177+
curl -X GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/eastus/usages?api-version=2023-05-01 \
178+
-H "Content-Type: application/json" \
179+
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
180+
```
181+
152182
# [Azure CLI](#tab/cli)
153183

154184
Install the [Azure CLI](/cli/azure/install-azure-cli). Quota requires `Azure CLI version 2.51.0`. If you already have Azure CLI installed locally run `az upgrade` to update to the latest version.
@@ -184,7 +214,23 @@ By setting sku-capacity to 10 in the command below this deployment will be set w
184214
az cognitiveservices account deployment create -g test-resource-group -n test-resource-name --deployment-name test-deployment-name --model-name gpt-35-turbo --model-version "0613" --model-format OpenAI --sku-capacity 10 --sku-name "Standard"
185215
```
186216

187-
For more details, consult the [full Azure CLI reference documentation](https://learn.microsoft.com/en-us]/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest)
217+
### Usage
218+
219+
To [query your quota usage](/cli/azure/cognitiveservices/usage?view=azure-cli-latest) in a given region, for a specific subscription
220+
221+
```azurecli
222+
az cognitiveservices usage list --location
223+
```
224+
225+
### Example
226+
227+
```azurecli
228+
az cognitiveservices usage list -l eastus
229+
```
230+
231+
This command runs in the context of the currently active subscription for Azure CLI. Use `az-account-set --subscription` to [modify the active subscription](/cli/azure/manage-azure-subscriptions-azure-cli#change-the-active-subscription).
232+
233+
For more details on `az cognitiveservices account` and `az cognitivesservices usage` consult the [Azure CLI reference documentation](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest)
188234

189235
# [Azure Resource Manager](#tab/arm)
190236

0 commit comments

Comments
 (0)