Skip to content

Commit 900a296

Browse files
Enable system-assigned managed identity support for existing Foundry projects and add documentation for reusing existing Azure AI Foundry project
1 parent 9844255 commit 900a296

File tree

8 files changed

+71
-10
lines changed

8 files changed

+71
-10
lines changed

docs/DeploymentGuide.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ When you start the deployment, most parameters will have **default values**, but
153153
| **GPT Model Capacity** | Sets the GPT model capacity. | 150 |
154154
| **Image Tag** | Docker image tag used for container deployments. | latest |
155155
| **Enable Telemetry** | Enables telemetry for monitoring and diagnostics. | true |
156-
156+
| **Existing Log Analytics Workspace** | To reuse an existing Log Analytics Workspace ID instead of creating a new one. | *(none)* |
157+
| **Existing Azure AI Foundry Project** | To reuse an existing Azure AI Foundry Project ID instead of creating a new one. | *(none)* |
157158

158159
</details>
159160

@@ -176,6 +177,14 @@ To adjust quota settings, follow these [steps](./AzureGPTQuotaSettings.md).
176177

177178
</details>
178179

180+
<details>
181+
182+
<summary><b>Reusing an Existing Azure AI Foundry Project</b></summary>
183+
184+
Guide to get your [Existing Project ID](/docs/re-use-foundry-project.md)
185+
186+
</details>
187+
179188
### Deploying with AZD
180189

181190
Once you've opened the project in [Codespaces](#github-codespaces), [Dev Containers](#vs-code-dev-containers), or [locally](#local-environment), you can deploy it to Azure by following these steps:
331 KB
Loading
94.9 KB
Loading
196 KB
Loading

docs/re-use-foundry-project.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[← Back to *DEPLOYMENT* guide](/docs/DeploymentGuide.md#deployment-options--steps)
2+
3+
# Reusing an Existing Azure AI Foundry Project
4+
To configure your environment to use an existing Azure AI Foundry Project, follow these steps:
5+
---
6+
### 1. Go to Azure Portal
7+
Go to https://portal.azure.com
8+
9+
### 2. Search for Azure AI Foundry
10+
In the search bar at the top, type "Azure AI Foundry" and click on it. Then select the Foundry service instance where your project exists.
11+
12+
![alt text](../docs/images/re_use_foundry_project/azure_ai_foundry_list.png)
13+
14+
### 3. Navigate to Projects under Resource Management
15+
On the left sidebar of the Foundry service blade:
16+
17+
- Expand the Resource Management section
18+
- Click on Projects (this refers to the active Foundry project tied to the service)
19+
20+
### 4. Click on the Project
21+
From the Projects view: Click on the project name to open its details
22+
23+
Note: You will see only one project listed here, as each Foundry service maps to a single project in this accelerator
24+
25+
![alt text](../docs/images/re_use_foundry_project/navigate_to_projects.png)
26+
27+
### 5. Copy Resource ID
28+
In the left-hand menu of the project blade:
29+
30+
- Click on Properties under Resource Management
31+
- Locate the Resource ID field
32+
- Click on the copy icon next to the Resource ID value
33+
34+
![alt text](../docs/images/re_use_foundry_project/project_resource_id.png)
35+
36+
### 6. Set the Foundry Project Resource ID in Your Environment
37+
Run the following command in your terminal
38+
```bash
39+
azd env set AZURE_ENV_FOUNDRY_PROJECT_ID '<Existing Foundry Project Resource ID>'
40+
```
41+
Replace `<Existing Foundry Project Resource ID>` with the value obtained from Step 5.
42+
43+
### 7. Continue Deployment
44+
Proceed with the next steps in the [deployment guide](/docs/DeploymentGuide.md#deployment-options--steps).

infra/modules/account/main.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ module existing_cognigive_service_dependencies 'modules/dependencies.bicep' = if
277277
projectName: projectName
278278
projectDescription: projectDescription
279279
azureExistingAIProjectResourceId: existingFoundryProjectResourceId
280-
location: location
280+
location: cognitiveServiceExisting.?location!
281281
deployments: deployments
282282
diagnosticSettings: diagnosticSettings
283283
lock: lock
@@ -311,8 +311,8 @@ output endpoint string = useExistingService ? cognitiveServiceExisting.propertie
311311
output endpoints endpointType = useExistingService ? cognitiveServiceExisting.properties.endpoints : cognitiveService.properties.endpoints
312312

313313
@description('The principal ID of the system assigned identity.')
314-
output systemAssignedMIPrincipalId string? = useExistingService ? cognitiveServiceExisting.identity.principalId : cognitiveService.?identity.?principalId
315-
314+
output systemAssignedMIPrincipalId string? = useExistingService ? cognitiveServiceExisting.?identity.?principalId : cognitiveService.?identity.?principalId
315+
316316
@description('The location the resource was deployed into.')
317317
output location string = useExistingService ? cognitiveServiceExisting.location : cognitiveService.location
318318

infra/modules/account/modules/dependencies.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ param name string
2323
])
2424
param sku string = 'S0'
2525

26-
@description('Optional. Location for all Resources.')
27-
param location string = resourceGroup().location
26+
@description('Optional. Location for Cognitive Services.')
27+
param location string
2828

2929
@description('Optional. Tags of the resource.')
3030
param tags object?

infra/modules/account/modules/project.bicep

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
param name string
33

44
@description('Required. The location of the Project resource.')
5-
param location string = resourceGroup().location
5+
param location string
66

77
@description('Optional. The description of the AI Foundry project to create. Defaults to the project name.')
88
param desc string = name
@@ -40,11 +40,19 @@ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-pre
4040
}
4141
}
4242

43+
// Assign identity to existing project
44+
resource existingProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = if (useExistingProject && !empty(existingProjName)) {
45+
name: existingProjName
46+
parent: cogServiceReference
47+
location: location
48+
identity: { type: 'SystemAssigned' }
49+
}
50+
4351
@description('AI Project metadata including name, resource ID, and API endpoint.')
4452
output aiProjectInfo aiProjectOutputType = {
45-
name: useExistingProject ? existingProjName : aiProject.name
46-
resourceId: useExistingProject ? azureExistingAIProjectResourceId : aiProject.id
47-
apiEndpoint: useExistingProject ? existingProjEndpoint : aiProject.properties.endpoints['AI Foundry API']
53+
name: useExistingProject ? existingProject.name : aiProject.name
54+
resourceId: useExistingProject ? existingProject.id : aiProject.id
55+
apiEndpoint: useExistingProject ? existingProject.properties.endpoints['AI Foundry API'] : aiProject.properties.endpoints['AI Foundry API']
4856
}
4957

5058
@export()

0 commit comments

Comments
 (0)