Skip to content

Commit 33077bd

Browse files
authored
Merge pull request #17 from Azure-Samples/gk/azd-updates
output necessary values for local settings
2 parents 2059da5 + 03bd729 commit 33077bd

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

infra/core/ai/cognitive-services.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,9 @@ resource chatModelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2
8484
output aiServicesName string = aiServices.name
8585
output aiServicesId string = aiServices.id
8686
output aiServicesEndpoint string = aiServices.properties.endpoint
87+
output azureOpenAIServiceEndpoint string = 'https://${aiServices.properties.customSubDomainName}.openai.azure.com/'
8788
output embeddingDeploymentName string = embeddingModelDeployment.name
8889
output chatDeploymentName string = chatModelDeployment.name
90+
@description('Primary key for the AI Services account.')
91+
@secure()
92+
output primaryKey string = aiServices.listKeys().key1

infra/main.bicep

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,27 @@ module api './app/api.bicep' = {
231231
}
232232
}
233233

234-
// App outputs
235-
output APPLICATIONINSIGHTS_CONNECTION_STRING string = monitoring.outputs.applicationInsightsConnectionString
236-
output AZURE_LOCATION string = location
237-
output AZURE_TENANT_ID string = tenant().tenantId
238-
output SERVICE_API_NAME string = api.outputs.SERVICE_API_NAME
239-
output AZURE_FUNCTION_NAME string = api.outputs.SERVICE_API_NAME
240-
output COSMOS_ENDPOINT string = cosmosDb.outputs.documentEndpoint
241-
output OPENAI_ENDPOINT string = openai.outputs.aiServicesEndpoint
234+
// ==================================
235+
// Outputs
236+
// ==================================
237+
// Define outputs needed specifically for configuring local.settings.json
238+
// Use 'azd env get-values' to retrieve these after provisioning.
239+
// WARNING: Secrets (Keys, Connection Strings) are output directly and will be visible in deployment history.
240+
// Output names directly match the corresponding keys in local.settings.json for easier mapping.
241+
242+
@description('Cosmos DB connection string (includes key). Output name matches the COSMOS_CONN key in local settings.')
243+
output COSMOS_CONN string = cosmosDb.outputs.connectionString
244+
245+
@description('Connection string for the Azure AI Project. Output name matches the PROJECT_CONNECTION_STRING key in local settings.')
242246
output PROJECT_CONNECTION_STRING string = aiProject.outputs.projectConnectionString
247+
248+
@description('Endpoint for Azure OpenAI services. Output name matches the AZURE_OPENAI_ENDPOINT key in local settings.')
249+
output AZURE_OPENAI_ENDPOINT string = openai.outputs.azureOpenAIServiceEndpoint
250+
251+
@description('Primary key for Azure OpenAI services. Output name matches the AZURE_OPENAI_KEY key in local settings.')
252+
// @secure() - issue with latest bicep version, set secure in cognitive services module
253+
output AZURE_OPENAI_KEY string = openai.outputs.primaryKey
254+
255+
@description('Name of the deployed Azure Function App.')
256+
output AZURE_FUNCTION_NAME string = api.outputs.SERVICE_API_NAME // Function App Name
257+

src/local.settings.example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"AGENTS_MODEL_DEPLOYMENT_NAME": "gpt-4o",
1212
"COSMOS_CONN": "AccountEndpoint=https://<cosmos-account-name>.documents.azure.com:443/;AccountKey=<cosmos-account-key>;",
1313
"PROJECT_CONNECTION_STRING": "<region>.api.azureml.ms;<workspace-id>;<project-name>;<project-name>",
14-
"AZURE_OPENAI_ENDPOINT": "https://ai-<uri-from-ai-foundry-models-page>.openai.azure.com/",
15-
"AZURE_OPENAI_KEY": "<api-key-from-ai-foundry-models-page>"
14+
"AZURE_OPENAI_ENDPOINT": "https://<service-id>.openai.azure.com/",
15+
"AZURE_OPENAI_KEY": "<your-azure-openai-key>"
1616
}
1717
}

0 commit comments

Comments
 (0)