22param 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.' )
88param desc string = name
@@ -19,7 +19,7 @@ param azureExistingAIProjectResourceId string = ''
1919// // Extract components from existing AI Project Resource ID if provided
2020var useExistingProject = !empty (azureExistingAIProjectResourceId )
2121var existingProjName = useExistingProject ? last (split (azureExistingAIProjectResourceId , '/' )) : ''
22- var existingProjEndpoint = useExistingProject ? format ('https://{0}.services.ai.azure.com/api/projects/{1}' , aiServicesName , existingProjName ) : ''
22+ // var existingProjEndpoint = useExistingProject ? format('https://{0}.services.ai.azure.com/api/projects/{1}', aiServicesName, existingProjName) : ''
2323
2424// Reference to cognitive service in current resource group for new projects
2525resource cogServiceReference 'Microsoft.CognitiveServices/accounts@2024-10-01' existing = {
@@ -41,11 +41,19 @@ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-pre
4141 }
4242}
4343
44+ // Assign identity to existing project
45+ resource existingProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = if (useExistingProject && !empty (existingProjName )) {
46+ name : existingProjName
47+ parent : cogServiceReference
48+ location : location
49+ identity : { type : 'SystemAssigned' }
50+ }
51+
4452@description ('AI Project metadata including name, resource ID, and API endpoint.' )
4553output aiProjectInfo aiProjectOutputType = {
46- name : useExistingProject ? existingProjName : aiProject .name
47- resourceId : useExistingProject ? azureExistingAIProjectResourceId : aiProject .id
48- apiEndpoint : useExistingProject ? existingProjEndpoint : aiProject .properties .endpoints ['AI Foundry API' ]
54+ name : useExistingProject ? existingProject . name : aiProject .name
55+ resourceId : useExistingProject ? existingProject . id : aiProject .id
56+ apiEndpoint : useExistingProject ? existingProject . properties . endpoints [ 'AI Foundry API' ] : aiProject .properties .endpoints ['AI Foundry API' ]
4957}
5058
5159@export ()
0 commit comments