Skip to content

Commit 55e201f

Browse files
committed
writing and cli
1 parent 74f7f46 commit 55e201f

File tree

2 files changed

+64
-7
lines changed

2 files changed

+64
-7
lines changed

articles/ai-studio/how-to/create-projects.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ Use the tabs below to select the method you plan to use to create a project:
4141
my_project_name = "myexampleproject"
4242
my_location = "East US"
4343
my_display_name = "My Example Project"
44+
hub_id = "" # Azure resource manager ID of the hub
4445

45-
my_hub = Project(name=my_hub_name,
46+
my_project = Project(name=my_hub_name,
4647
location=my_location,
4748
display_name=my_display_name,
4849
hub_id=created_hub.id)

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

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: How to create a hub using the Azure Machine Learning SDK
2+
title: How to create a hub using the Azure Machine Learning SDK/CLI
33
titleSuffix: Azure AI Studio
4-
description: This article provides instructions on how to create an AI Studio hub using the Azure Machine Learning SDK.
4+
description: This article provides instructions on how to create an AI Studio hub using the Azure Machine Learning SDK and Azure CLI extension.
55
manager: nitinme
66
ms.service: azure-ai-studio
77
ms.custom:
@@ -13,11 +13,11 @@ ms.author: eur
1313
author: eric-urban
1414
---
1515

16-
# Create a hub using the Azure Machine Learning SDK
16+
# Create a hub using the Azure Machine Learning SDK and CLI
1717

1818
[!INCLUDE [Feature preview](~/reusable-content/ce-skilling/azure/includes/ai-studio/includes/feature-preview.md)]
1919

20-
In this article, you learn how to create the following AI Studio resources using the Azure Machine Learning SDK:
20+
In this article, you learn how to create the following AI Studio resources using the Azure Machine Learning SDK and Azure CLI (with machine learning extension):
2121
- An Azure AI Studio hub
2222
- An Azure AI Services connection
2323

@@ -27,15 +27,26 @@ In this article, you learn how to create the following AI Studio resources using
2727

2828
## Set up your environment
2929

30+
Use the tabs below to select whether you are using the Python SDK or Azure CLI:
31+
32+
# [Python SDK](#tab/python)
33+
3034
[!INCLUDE [SDK setup](../../includes/development-environment-config.md)]
3135

36+
# [Azure CLI](#tab/azurecli)
37+
38+
TODO
39+
40+
---
41+
3242
## Create the AI Studio hub and AI Services connection
3343

44+
# [Python SDK](#tab/python)
45+
3446
Use the following code to create a new hub and AI Services connection. Replace example string values with your own values:
3547

3648
```Python
3749
from azure.ai.ml.entities import Hub
38-
from azure.ai.ml.entities import AzureAIServicesConnection
3950

4051
my_hub_name = "myexamplehub"
4152
my_location = "East US"
@@ -48,21 +59,66 @@ my_hub = Hub(name=my_hub_name,
4859

4960
created_hub = ml_client.workspaces.begin_create(my_hub).result()
5061

62+
```
63+
64+
# [Azure CLI](#tab/azurecli)
65+
66+
```azurecli
67+
az ml workspace --kind hub --resource-group {my_resource_group} --name {my_hub_name}
68+
```
69+
70+
---
71+
72+
## Create an AI Services connection
73+
74+
After creating your own AI Services, you can connect it to your hub:
75+
76+
# [Python SDK](#tab/python)
77+
78+
```python
79+
from azure.ai.ml.entities import AzureAIServicesConnection
80+
5181
# constrict an AI Services connection
5282
my_connection_name = "myaiservivce"
5383
my_endpoint = "demo.endpoint" # this could also be called target
5484
my_api_keys = None # leave blank for Authentication type = AAD
5585
my_ai_services_resource_id = "" # ARM id required
5686

57-
my_connection = AIServicesConnection(name=my_connection_name,
87+
my_connection = AzureAIServicesConnection(name=my_connection_name,
5888
endpoint=my_endpoint,
5989
api_key= my_api_keys,
6090
ai_services_resource_id=my_ai_services_resource_id)
6191

92+
# Create the connection
6293
ml_client.connections.create_or_update(my_connection)
6394
```
6495

96+
# [Azure CLI](#tab/azurecli)
97+
98+
```azurecli
99+
az ml connection create --file {connection.yml} --resource-group {MY_RESOURCE_GROUP} --workspace-name {MY_PROJECT_NAME}
100+
```
101+
102+
You can use either an API key or credential-less YAML configuration file:
103+
104+
- API Key example:
105+
106+
```yml
107+
name: myazai_ei
108+
type: azure_ai_services
109+
endpoint: https://contoso.cognitiveservices.azure.com/
110+
api_key: XXXXXXXXXXXXXXX
111+
```
65112
113+
- Credential-less
114+
115+
```yml
116+
name: myazai_apk
117+
type: azure_ai_services
118+
endpoint: https://contoso.cognitiveservices.azure.com/
119+
```
120+
121+
---
66122
67123
## Related content
68124

0 commit comments

Comments
 (0)