Skip to content

Commit 4f5397e

Browse files
Merge pull request #1076 from Blackmist/330397
330397
2 parents 03fb816 + d6b7d4d commit 4f5397e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

articles/ai-studio/how-to/develop/create-hub-project-sdk.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,43 @@ You can use either an API key or credential-less YAML configuration file. For mo
127127
128128
---
129129
130+
## Create an AI Studio hub using existing dependency resources
131+
132+
You can also create a hub using existing resources such as Azure Storage and Azure Key Vault. In the following examples, replace the example string values with your own values:
133+
134+
> [!TIP]
135+
> You can retrieve the resource ID of the storage account and key vault from the Azure Portal by going to the resource's overview and selecting __JSON view__. The resource ID is located in the __id__ field. You can also use the Azure CLI to retrieve the resource ID. For example, `az storage account show --name {my_storage_account_name} --query "id"` and `az keyvault show --name {my_key_vault_name} --query "id"`.
136+
137+
# [Python SDK](#tab/python)
138+
139+
```Python
140+
from azure.ai.ml.entities import Hub
141+
142+
my_hub_name = "myexamplehub"
143+
my_location = "East US"
144+
my_display_name = "My Example Hub"
145+
my_resource_group = "myresourcegroupname"
146+
my_storage_account_id = "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myresourcegroupname/providers/Microsoft.Storage/storageAccounts/mystorageaccountname"
147+
my_key_vault_id = "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myresourcegroupname/providers/Microsoft.KeyVault/vaults/mykeyvaultname"
148+
149+
# construct a basic hub
150+
my_hub = Hub(name=my_hub_name,
151+
location=my_location,
152+
display_name=my_display_name,
153+
resource_group=my_resource_group,
154+
storage_account_id=my_storage_account_id,
155+
key_vault_id=my_key_vault_id)
156+
157+
created_hub = ml_client.workspaces.begin_create(my_hub).result()
158+
```
159+
160+
# [Azure CLI](#tab/azurecli)
161+
162+
```azurecli
163+
az ml workspace create --kind hub --resource-group {my_resource_group} --name {my_hub_name} --location {hub-region} --storage-account {my_storage_account_id} --key-vault {my_key_vault_id}
164+
```
165+
166+
130167
## Related content
131168

132169
- [Get started building a chat app using the prompt flow SDK](../../quickstarts/get-started-code.md)

0 commit comments

Comments
 (0)