Skip to content

Commit 52389e1

Browse files
committed
update
1 parent 4d6505a commit 52389e1

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-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).

0 commit comments

Comments
 (0)