Skip to content

Commit 48e221f

Browse files
committed
replace code with references
1 parent 61da8db commit 48e221f

File tree

2 files changed

+4
-54
lines changed

2 files changed

+4
-54
lines changed

articles/ai-foundry/includes/create-project-fdp.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,8 @@ Use the following tabs to select the method you plan to use to create a [!INCLUD
5151
1. Use `pip show azure-mgmt-cognitiveservices` to verify your version is 13.7 or greater.
5252
1. Start your script with the following code to create the `client` connection and variables used throughout this article. This example creates the project in West US:
5353

54-
```python
55-
from azure.identity import DefaultAzureCredential
56-
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient
57-
58-
sub_id = 'your-sub'
59-
rgp = 'your-resource-group'
60-
resource_name = 'your-resource'
61-
project_name = 'your-project'
62-
location = 'westus'
63-
64-
client = CognitiveServicesManagementClient(
65-
credential=DefaultAzureCredential(),
66-
subscription_id=sub_id,
67-
api_version="2025-04-01-preview"
68-
)
54+
:::code language="python" source="~/foundry-samples-main/samples/microsoft/python/mslearn-resources/quickstart/quickstart.py" id="create_client":::
55+
6956

7057

7158
# [Azure CLI](#tab/azurecli)
@@ -120,32 +107,8 @@ To create a [!INCLUDE [fdp](../includes/fdp-project-name.md)]:
120107

121108
1. Add this code to create a [!INCLUDE [fdp-project-name](../includes/fdp-project-name.md)], using the variables and `client` connection from the [Prerequisites](#prerequisites).
122109

123-
```python
110+
:::code language="python" source="~/foundry-samples-main/samples/microsoft/python/mslearn-resources/quickstart/quickstart.py" id="create_resource_project":::
124111

125-
# Create resource
126-
resource = client.accounts.begin_create(
127-
resource_group_name=rgp,
128-
account_name=resource_name,
129-
account={
130-
"location": location,
131-
"kind": "AIServices",
132-
"sku": {"name": "S0",},
133-
"identity": {"type": "SystemAssigned"},
134-
"properties": {"allowProjectManagement": True}
135-
}
136-
)
137-
# Create default project
138-
project = client.projects.begin_create(
139-
resource_group_name=rgp,
140-
account_name=resource_name,
141-
project_name=project_name,
142-
project={
143-
"location": location,
144-
"identity": {"type": "SystemAssigned"},
145-
"properties": {}
146-
}
147-
)
148-
```
149112
1. (Optional) If you have multiple accounts, add the tenant ID of the Microsoft Entra ID you wish to use into the `DefaultAzureCredential`. Find your tenant ID from the [Azure portal](https://portal.azure.com) under **Microsoft Entra ID, External Identities**.
150113

151114
```python

articles/ai-foundry/includes/create-second-fdp-project.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,7 @@ Your first project (default project) plays a special role and has access to more
5353

5454
Add this code to your script to create a new project on your existing
5555

56-
```python
57-
new_project_name = 'your-new-project-name'
58-
59-
project = client.projects.begin_create(
60-
resource_group_name=rgp,
61-
account_name=resource_name,
62-
project_name=new_project_name,
63-
project={
64-
"location": location,
65-
"identity": {"type": "SystemAssigned"},
66-
"properties": {}
67-
}
68-
)
69-
```
56+
:::code language="python" source="~/foundry-samples-main/samples/microsoft/python/mslearn-resources/quickstart/quickstart.py" id="create_additional":::
7057

7158

7259
# [Azure CLI](#tab/azurecli)

0 commit comments

Comments
 (0)