diff --git a/docs/DeploymentGuide.md b/docs/DeploymentGuide.md index 362c64c5a..3c39384d1 100644 --- a/docs/DeploymentGuide.md +++ b/docs/DeploymentGuide.md @@ -153,7 +153,8 @@ When you start the deployment, most parameters will have **default values**, but | **GPT Model Capacity** | Sets the GPT model capacity. | 150 | | **Image Tag** | Docker image tag used for container deployments. | latest | | **Enable Telemetry** | Enables telemetry for monitoring and diagnostics. | true | - +| **Existing Log Analytics Workspace** | To reuse an existing Log Analytics Workspace ID instead of creating a new one. | *(none)* | +| **Existing Azure AI Foundry Project** | To reuse an existing Azure AI Foundry Project ID instead of creating a new one. | *(none)* | @@ -176,6 +177,14 @@ To adjust quota settings, follow these [steps](./AzureGPTQuotaSettings.md). +
+ + Reusing an Existing Azure AI Foundry Project + + Guide to get your [Existing Project ID](/docs/re-use-foundry-project.md) + +
+ ### Deploying with AZD 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: diff --git a/docs/images/re_use_foundry_project/azure_ai_foundry_list.png b/docs/images/re_use_foundry_project/azure_ai_foundry_list.png new file mode 100644 index 000000000..784bc85c7 Binary files /dev/null and b/docs/images/re_use_foundry_project/azure_ai_foundry_list.png differ diff --git a/docs/images/re_use_foundry_project/navigate_to_projects.png b/docs/images/re_use_foundry_project/navigate_to_projects.png new file mode 100644 index 000000000..11082c15c Binary files /dev/null and b/docs/images/re_use_foundry_project/navigate_to_projects.png differ diff --git a/docs/images/re_use_foundry_project/project_resource_id.png b/docs/images/re_use_foundry_project/project_resource_id.png new file mode 100644 index 000000000..7835ea9d3 Binary files /dev/null and b/docs/images/re_use_foundry_project/project_resource_id.png differ diff --git a/docs/re-use-foundry-project.md b/docs/re-use-foundry-project.md new file mode 100644 index 000000000..a0f9a06f2 --- /dev/null +++ b/docs/re-use-foundry-project.md @@ -0,0 +1,44 @@ +[← Back to *DEPLOYMENT* guide](/docs/DeploymentGuide.md#deployment-options--steps) + +# Reusing an Existing Azure AI Foundry Project +To configure your environment to use an existing Azure AI Foundry Project, follow these steps: +--- +### 1. Go to Azure Portal +Go to https://portal.azure.com + +### 2. Search for Azure AI Foundry +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. + +![alt text](../docs/images/re_use_foundry_project/azure_ai_foundry_list.png) + +### 3. Navigate to Projects under Resource Management +On the left sidebar of the Foundry service blade: + +- Expand the Resource Management section +- Click on Projects (this refers to the active Foundry project tied to the service) + +### 4. Click on the Project +From the Projects view: Click on the project name to open its details + + Note: You will see only one project listed here, as each Foundry service maps to a single project in this accelerator + +![alt text](../docs/images/re_use_foundry_project/navigate_to_projects.png) + +### 5. Copy Resource ID +In the left-hand menu of the project blade: + +- Click on Properties under Resource Management +- Locate the Resource ID field +- Click on the copy icon next to the Resource ID value + +![alt text](../docs/images/re_use_foundry_project/project_resource_id.png) + +### 6. Set the Foundry Project Resource ID in Your Environment +Run the following command in your terminal +```bash +azd env set AZURE_ENV_FOUNDRY_PROJECT_ID '' +``` +Replace `` with the value obtained from Step 5. + +### 7. Continue Deployment +Proceed with the next steps in the [deployment guide](/docs/DeploymentGuide.md#deployment-options--steps). diff --git a/infra/modules/account/main.bicep b/infra/modules/account/main.bicep index b1fad4456..552cb5242 100644 --- a/infra/modules/account/main.bicep +++ b/infra/modules/account/main.bicep @@ -277,7 +277,7 @@ module existing_cognigive_service_dependencies 'modules/dependencies.bicep' = if projectName: projectName projectDescription: projectDescription azureExistingAIProjectResourceId: existingFoundryProjectResourceId - location: location + location: cognitiveServiceExisting.?location! deployments: deployments diagnosticSettings: diagnosticSettings lock: lock @@ -311,8 +311,8 @@ output endpoint string = useExistingService ? cognitiveServiceExisting.propertie output endpoints endpointType = useExistingService ? cognitiveServiceExisting.properties.endpoints : cognitiveService.properties.endpoints @description('The principal ID of the system assigned identity.') -output systemAssignedMIPrincipalId string? = useExistingService ? cognitiveServiceExisting.identity.principalId : cognitiveService.?identity.?principalId - +output systemAssignedMIPrincipalId string? = useExistingService ? cognitiveServiceExisting.?identity.?principalId : cognitiveService.?identity.?principalId + @description('The location the resource was deployed into.') output location string = useExistingService ? cognitiveServiceExisting.location : cognitiveService.location diff --git a/infra/modules/account/modules/dependencies.bicep b/infra/modules/account/modules/dependencies.bicep index c2d7de6f8..9aea2dc56 100644 --- a/infra/modules/account/modules/dependencies.bicep +++ b/infra/modules/account/modules/dependencies.bicep @@ -23,8 +23,8 @@ param name string ]) param sku string = 'S0' -@description('Optional. Location for all Resources.') -param location string = resourceGroup().location +@description('Optional. Location for Cognitive Services.') +param location string @description('Optional. Tags of the resource.') param tags object? diff --git a/infra/modules/account/modules/project.bicep b/infra/modules/account/modules/project.bicep index 8ca346546..b8490008f 100644 --- a/infra/modules/account/modules/project.bicep +++ b/infra/modules/account/modules/project.bicep @@ -2,7 +2,7 @@ param name string @description('Required. The location of the Project resource.') -param location string = resourceGroup().location +param location string @description('Optional. The description of the AI Foundry project to create. Defaults to the project name.') param desc string = name @@ -40,11 +40,19 @@ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-pre } } +// Assign identity to existing project +resource existingProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = if (useExistingProject && !empty(existingProjName)) { + name: existingProjName + parent: cogServiceReference + location: location + identity: { type: 'SystemAssigned' } +} + @description('AI Project metadata including name, resource ID, and API endpoint.') output aiProjectInfo aiProjectOutputType = { - name: useExistingProject ? existingProjName : aiProject.name - resourceId: useExistingProject ? azureExistingAIProjectResourceId : aiProject.id - apiEndpoint: useExistingProject ? existingProjEndpoint : aiProject.properties.endpoints['AI Foundry API'] + name: useExistingProject ? existingProject.name : aiProject.name + resourceId: useExistingProject ? existingProject.id : aiProject.id + apiEndpoint: useExistingProject ? existingProject.properties.endpoints['AI Foundry API'] : aiProject.properties.endpoints['AI Foundry API'] } @export()