Skip to content

Commit 26493a4

Browse files
authored
Merge pull request #2421 from MicrosoftDocs/main
Publish to live, Wednesday 4AM PST, 1/22
2 parents 4667dab + 1c56f1b commit 26493a4

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

articles/ai-services/openai/how-to/role-based-access-control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This role is typically granted access at the resource group level for a user in
9999
✅ Create new model deployments or edit existing model deployments (via API) <br>
100100
✅ Create custom fine-tuned models **[Added Fall 2023]**<br>
101101
✅ Upload datasets for fine-tuning **[Added Fall 2023]**<br>
102-
✅ Create new model deployments or edit existing model deployments (via Azure AI Foundry) **[Added Fall 2023]**
102+
✅ Create new model deployments or edit existing model deployments (via Azure AI Foundry) **[Added Fall 2023]**<br>
103103
✅ View, query, filter Stored completions data <br>
104104

105105

articles/ai-services/openai/includes/fine-tuning-python.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,55 @@ print(r.json())
503503

504504
To deploy between the same subscription, but different regions you would just have subscription and resource groups be identical for both source and destination variables and only the source and destination resource names would need to be unique.
505505

506+
### Cross tenant deployment
507+
508+
The accounts used to generate access tokens with `az account get-access-token --tenant` should have Cognitive Services OpenAI Contributor permissions to the associated Azure OpenAI resources.
509+
510+
```python
511+
import requests
512+
513+
subscription = "DESTINATION-SUBSCRIPTION-ID"
514+
resource_group = "DESTINATION-RESOURCE-GROUP"
515+
resource_name = "DESTINATION-AZURE-OPENAI-RESOURCE-NAME"
516+
model_deployment_name = "DESTINATION-MODEL-DEPLOYMENT-NAME"
517+
fine_tuned_model = "gpt-4o-mini-2024-07-18.ft-f8838e7c6d4a4cbe882a002815758510" #source fine-tuned model id example id provided
518+
source_subscription_id = "SOURCE-SUBSCRIPTION-ID"
519+
source_resource_group = "SOURCE-RESOURCE-GROUP"
520+
source_account = "SOURCE-AZURE-OPENAI-RESOURCE-NAME"
521+
522+
dest_token = "DESTINATION-ACCESS-TOKEN" # az account get-access-token --tenant DESTINATION-TENANT-ID
523+
source_token = "SOURCE-ACCESS-TOKEN" # az account get-access-token --tenant SOURCE-TENANT-ID
524+
525+
headers = {
526+
"Authorization": f"Bearer {dest_token}",
527+
"x-ms-authorization-auxiliary": f"Bearer {source_token}",
528+
"Content-Type": "application/json"
529+
}
530+
531+
url = f"https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.CognitiveServices/accounts/{resource_name}/deployments/{model_deployment_name}?api-version=2024-10-01"
532+
533+
payload = {
534+
"sku": {
535+
"name": "standard",
536+
"capacity": 1
537+
},
538+
"properties": {
539+
"model": {
540+
"format": "OpenAI",
541+
"name": fine_tuned_model,
542+
"version": "1",
543+
"sourceAccount": f"/subscriptions/{source_subscription_id}/resourceGroups/{source_resource_group}/providers/Microsoft.CognitiveServices/accounts/{source_account}"
544+
}
545+
}
546+
}
547+
548+
response = requests.put(url, headers=headers, json=payload)
549+
550+
# Check response
551+
print(f"Status Code: {response.status_code}")
552+
print(f"Response: {response.json()}")
553+
```
554+
506555
### Deploy a model with Azure CLI
507556

508557
The following example shows how to use the Azure CLI to deploy your customized model. With the Azure CLI, you must specify a name for the deployment of your customized model. For more information about how to use the Azure CLI to deploy customized models, see [`az cognitiveservices account deployment`](/cli/azure/cognitiveservices/account/deployment).

articles/ai-services/openai/includes/fine-tuning-rest.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,29 @@ curl -X PUT "https://management.azure.com/subscriptions/<SUBSCRIPTION>/resourceG
322322

323323
To deploy between the same subscription, but different regions, you would just have subscription and resource groups be identical for both source and destination variables and only the source and destination resource names would need to be unique.
324324

325+
### Cross tenant deployment
326+
327+
The accounts used to generate access tokens with `az account get-access-token --tenant` should have Cognitive Services OpenAI Contributor permissions to the associated Azure OpenAI resources.
328+
329+
330+
```bash
331+
curl -X PUT "https://management.azure.com/subscriptions/<SUBSCRIPTION>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.CognitiveServices/accounts/<RESOURCE_NAME>/deployments/<MODEL_DEPLOYMENT_NAME>?api-version=2024-10-01" \
332+
-H "Authorization: Bearer <DESTINATION TOKEN>" \
333+
-H "x-ms-authorization-auxiliary: Bearer <SOURCE TOKEN>" \
334+
-H "Content-Type: application/json" \
335+
-d '{
336+
"sku": {"name": "standard", "capacity": 1},
337+
"properties": {
338+
"model": {
339+
"format": "OpenAI",
340+
"name": "<FINE_TUNED_MODEL>",
341+
"version": "1",
342+
"sourceAccount": "/subscriptions/{sourceSubscriptionID}/resourceGroups/{sourceResourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{sourceAccount}"
343+
}
344+
}
345+
}'
346+
```
347+
325348
### Deploy a model with Azure CLI
326349

327350
The following example shows how to use the Azure CLI to deploy your customized model. With the Azure CLI, you must specify a name for the deployment of your customized model. For more information about how to use the Azure CLI to deploy customized models, see [`az cognitiveservices account deployment`](/cli/azure/cognitiveservices/account/deployment).

articles/ai-services/openai/quotas-limits.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The following sections provide you with a quick guide to the default quotas and
5151
| GPT-4o max images per request (# of images in the messages array/conversation history) | 50 |
5252
| GPT-4 `vision-preview` & GPT-4 `turbo-2024-04-09` default max tokens | 16 <br><br> Increase the `max_tokens` parameter value to avoid truncated responses. GPT-4o max tokens defaults to 4096. |
5353
| Max number of custom headers in API requests<sup>1</sup> | 10 |
54+
| Message character limit | 1048576 |
5455

5556
<sup>1</sup> Our current APIs allow up to 10 custom headers, which are passed through the pipeline, and returned. Some customers now exceed this header count resulting in HTTP 431 errors. There's no solution for this error, other than to reduce header volume. **In future API versions we will no longer pass through custom headers**. We recommend customers not depend on custom headers in future system architectures.
5657

0 commit comments

Comments
 (0)