Skip to content

Commit 335ad4d

Browse files
fix: Deployment script removed for storage account key issue (#6440)
## Description <!-- >Thank you for your contribution ! > Please include a summary of the change and which issue is fixed. > Please also include the context. > List any dependencies that are required for this change. Fixes #123 Closes #123 --> ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> | Pipeline | | -------- | [![avm.ptn.sa.conversation-knowledge-mining](https://github.com/Ravikirana-Microsoft/bicep-registry-modules/actions/workflows/avm.ptn.sa.conversation-knowledge-mining.yml/badge.svg?branch=ckm_latest_test)](https://github.com/Ravikirana-Microsoft/bicep-registry-modules/actions/workflows/avm.ptn.sa.conversation-knowledge-mining.yml) ## Type of Change <!-- Use the checkboxes [x] on the options that are relevant. --> - Azure Verified Module updates: - [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation - [ ] Update to CI Environment or utilities (Non-module affecting changes) ## Checklist - [x] I'm sure there are no other open Pull Requests for the same update/change - [x] I have run `Set-AVMModule` locally to generate the supporting module files. - [x] My corresponding pipelines / checks run clean and green without any errors or warnings - [x] I have updated the module's CHANGELOG.md file with an entry for the next version <!-- Please keep up to date with the contribution guide at https://aka.ms/avm/contribute/bicep -->
1 parent 48ec9ae commit 335ad4d

File tree

11 files changed

+25358
-28420
lines changed

11 files changed

+25358
-28420
lines changed

avm/ptn/sa/conversation-knowledge-mining/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The latest version of the changelog can be found [here](https://github.com/Azure
77
### Changes
88

99
- Updated all the moudules including waf & non-waf with readme.
10+
- Removed usage of dpeloyment script bicep module.
1011

1112
### Breaking Changes
1213

avm/ptn/sa/conversation-knowledge-mining/README.md

Lines changed: 125 additions & 41 deletions
Large diffs are not rendered by default.

avm/ptn/sa/conversation-knowledge-mining/main.bicep

Lines changed: 304 additions & 389 deletions
Large diffs are not rendered by default.

avm/ptn/sa/conversation-knowledge-mining/main.json

Lines changed: 24848 additions & 27855 deletions
Large diffs are not rendered by default.

avm/ptn/sa/conversation-knowledge-mining/modules/ai-services.bicep

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ param managedIdentities managedIdentityAllType?
135135
@description('Optional. Array of deployments about cognitive service accounts to create.')
136136
param deployments deploymentType[]?
137137

138-
@description('Optional. Key vault reference and secret settings for the module\'s secrets export.')
139-
param secretsExportConfiguration secretsExportConfigurationType?
138+
@description('Optional. The resource ID of an existing Foundry project to use.')
139+
param existingFoundryProjectResourceId string = ''
140140

141141
var formattedUserAssignedIdentities = reduce(
142142
map((managedIdentities.?userAssignedResourceIds ?? []), (id) => { '${id}': {} }),
@@ -172,7 +172,9 @@ resource cMKUserAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentiti
172172
)
173173
}
174174

175-
resource cognitiveServiceNew 'Microsoft.CognitiveServices/accounts@2025-06-01' = {
175+
var useExistingService = !empty(existingFoundryProjectResourceId)
176+
177+
resource cognitiveServiceNew 'Microsoft.CognitiveServices/accounts@2025-06-01' = if(!useExistingService) {
176178
name: name
177179
kind: kind
178180
identity: identity
@@ -232,58 +234,78 @@ resource cognitiveServiceNew 'Microsoft.CognitiveServices/accounts@2025-06-01' =
232234
}
233235
}
234236

235-
module cognitive_service_dependencies './dependencies.bicep' = {
237+
var existingCognitiveServiceDetails = split(existingFoundryProjectResourceId, '/')
238+
239+
resource cognitiveServiceExisting 'Microsoft.CognitiveServices/accounts@2025-09-01' existing = if(useExistingService) {
240+
name: existingCognitiveServiceDetails[8]
241+
scope: resourceGroup(existingCognitiveServiceDetails[2], existingCognitiveServiceDetails[4])
242+
}
243+
244+
module cognitive_service_dependencies './dependencies.bicep' = if(!useExistingService) {
245+
params: {
246+
projectName: projectName
247+
projectDescription: projectDescription
248+
name: cognitiveServiceNew.name
249+
location: location
250+
deployments: deployments
251+
diagnosticSettings: diagnosticSettings
252+
lock: lock
253+
privateEndpoints: privateEndpoints
254+
roleAssignments: roleAssignments
255+
sku: sku
256+
tags: tags
257+
}
258+
}
259+
260+
module existing_cognitive_service_dependencies './dependencies.bicep' = if(useExistingService) {
236261
params: {
262+
name: cognitiveServiceExisting.name
237263
projectName: projectName
238264
projectDescription: projectDescription
239-
name: cognitiveServiceNew.name
265+
existingFoundryProjectResourceId: existingFoundryProjectResourceId
240266
location: location
241267
deployments: deployments
242268
diagnosticSettings: diagnosticSettings
243269
lock: lock
244270
privateEndpoints: privateEndpoints
245271
roleAssignments: roleAssignments
246-
secretsExportConfiguration: secretsExportConfiguration
247272
sku: sku
248273
tags: tags
249274
}
275+
scope: resourceGroup(existingCognitiveServiceDetails[2], existingCognitiveServiceDetails[4])
250276
}
251277

252-
// ========== Outputs ========== //
278+
var cognitiveService = useExistingService ? cognitiveServiceExisting : cognitiveServiceNew
253279

254280
@description('The name of the cognitive services account.')
255-
output name string = cognitiveServiceNew.name
281+
output name string = useExistingService ? cognitiveServiceExisting.name : cognitiveServiceNew.name
256282

257283
@description('The resource ID of the cognitive services account.')
258-
output resourceId string = cognitiveServiceNew.id
284+
output resourceId string = useExistingService ? cognitiveServiceExisting.id : cognitiveServiceNew.id
259285

260286
@description('The resource group the cognitive services account was deployed into.')
261-
output subscriptionId string = subscription().subscriptionId
287+
output subscriptionId string = useExistingService ? existingCognitiveServiceDetails[2] : subscription().subscriptionId
262288

263289
@description('The resource group the cognitive services account was deployed into.')
264-
output resourceGroupName string = resourceGroup().name
290+
output resourceGroupName string = useExistingService ? existingCognitiveServiceDetails[4] : resourceGroup().name
265291

266292
@description('The service endpoint of the cognitive services account.')
267-
output endpoint string = cognitiveServiceNew.properties.endpoint
293+
output endpoint string = useExistingService ? cognitiveServiceExisting!.properties.endpoint : cognitiveService.properties.endpoint
268294

269295
@description('All endpoints available for the cognitive services account, types depends on the cognitive service kind.')
270-
output endpoints endpointType = cognitiveServiceNew.properties.endpoints
296+
output endpoints endpointType = useExistingService ? cognitiveServiceExisting!.properties.endpoints : cognitiveService.properties.endpoints
271297

272298
@description('The principal ID of the system assigned identity.')
273-
output systemAssignedMIPrincipalId string? = cognitiveServiceNew.?identity.?principalId
299+
output systemAssignedMIPrincipalId string? = useExistingService ? cognitiveServiceExisting!.identity.principalId : cognitiveService.?identity.?principalId
274300

275301
@description('The location the resource was deployed into.')
276-
output location string = cognitiveServiceNew.location
302+
output location string = useExistingService ? cognitiveServiceExisting!.location : cognitiveService.location
277303

278-
import { secretsOutputType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
279-
@description('A hashtable of references to the secrets exported to the provided Key Vault. The key of each reference is each secret\'s name.')
280-
output exportedSecrets secretsOutputType = cognitive_service_dependencies!.outputs.exportedSecrets
281-
282-
@description('The private endpoints of the cognitive services account.')
283-
output privateEndpoints privateEndpointOutputType[] = cognitive_service_dependencies!.outputs.privateEndpoints
304+
@description('The private endpoints of the congitive services account.')
305+
output privateEndpoints privateEndpointOutputType[] = useExistingService ? existing_cognitive_service_dependencies!.outputs.privateEndpoints : cognitive_service_dependencies!.outputs.privateEndpoints
284306

285307
import { aiProjectOutputType } from './project.bicep'
286-
output aiProjectInfo aiProjectOutputType = cognitive_service_dependencies!.outputs.aiProjectInfo
308+
output aiProjectInfo aiProjectOutputType = useExistingService ? existing_cognitive_service_dependencies!.outputs.aiProjectInfo : cognitive_service_dependencies!.outputs.aiProjectInfo
287309

288310
// ================ //
289311
// Definitions //
@@ -365,16 +387,3 @@ type endpointType = {
365387
@description('The endpoint URI.')
366388
endpoint: string?
367389
}
368-
369-
@export()
370-
@description('The type of the secrets exported to the provided Key Vault.')
371-
type secretsExportConfigurationType = {
372-
@description('Required. The key vault name where to store the keys and connection strings generated by the modules.')
373-
keyVaultResourceId: string
374-
375-
@description('Optional. The name for the accessKey1 secret to create.')
376-
accessKey1Name: string?
377-
378-
@description('Optional. The name for the accessKey2 secret to create.')
379-
accessKey2Name: string?
380-
}

avm/ptn/sa/conversation-knowledge-mining/modules/dependencies.bicep

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ param tags object?
3232
@description('Optional. Array of deployments about cognitive service accounts to create.')
3333
param deployments deploymentType[]?
3434

35-
@description('Optional. Key vault reference and secret settings for the module\'s secrets export.')
36-
param secretsExportConfiguration secretsExportConfigurationType?
37-
3835
import { privateEndpointSingleServiceType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
3936
@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
4037
param privateEndpoints privateEndpointSingleServiceType[]?
@@ -57,6 +54,9 @@ param projectName string
5754
@description('Optional. Description for the project which needs to be created.')
5855
param projectDescription string
5956

57+
@description('Optional. Provide the existing project resource id in case if it needs to be reused')
58+
param existingFoundryProjectResourceId string = ''
59+
6060
var builtInRoleNames = {
6161
'Cognitive Services Contributor': subscriptionResourceId(
6262
'Microsoft.Authorization/roleDefinitions',
@@ -322,53 +322,21 @@ resource cognitiveService_roleAssignments 'Microsoft.Authorization/roleAssignmen
322322
}
323323
]
324324

325-
module secretsExport './keyVaultExport.bicep' = if (secretsExportConfiguration != null) {
326-
name: '${uniqueString(deployment().name, location)}-secrets-kv'
327-
scope: resourceGroup(
328-
split(secretsExportConfiguration.?keyVaultResourceId!, '/')[2],
329-
split(secretsExportConfiguration.?keyVaultResourceId!, '/')[4]
330-
)
331-
params: {
332-
keyVaultName: last(split(secretsExportConfiguration.?keyVaultResourceId!, '/'))
333-
secretsToSet: union(
334-
[],
335-
contains(secretsExportConfiguration!, 'accessKey1Name')
336-
? [
337-
{
338-
name: secretsExportConfiguration!.?accessKey1Name
339-
value: cognitiveService.listKeys().key1
340-
}
341-
]
342-
: [],
343-
contains(secretsExportConfiguration!, 'accessKey2Name')
344-
? [
345-
{
346-
name: secretsExportConfiguration!.?accessKey2Name
347-
value: cognitiveService.listKeys().key2
348-
}
349-
]
350-
: []
351-
)
352-
}
353-
}
354-
355-
module aiProject 'project.bicep' = if (!empty(projectName)) {
325+
module aiProject 'project.bicep' = if(!empty(projectName) || !empty(existingFoundryProjectResourceId)) {
356326
name: take('${name}-ai-project-${projectName}-deployment', 64)
357327
params: {
358328
name: projectName
359329
desc: projectDescription
360330
aiServicesName: cognitiveService.name
361331
location: location
362332
tags: tags
333+
existingFoundryProjectResourceId: existingFoundryProjectResourceId
363334
}
335+
dependsOn: [
336+
cognitiveService_deployments
337+
]
364338
}
365339

366-
import { secretsOutputType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
367-
@description('A hashtable of references to the secrets exported to the provided Key Vault. The key of each reference is each secret\'s name.')
368-
output exportedSecrets secretsOutputType = (secretsExportConfiguration != null)
369-
? toObject(secretsExport!.outputs.secretsSet, secret => last(split(secret.secretResourceId, '/')), secret => secret)
370-
: {}
371-
372340
@description('The private endpoints of the congitive services account.')
373341
output privateEndpoints privateEndpointOutputType[] = [
374342
for (pe, index) in (privateEndpoints ?? []): {
@@ -464,15 +432,3 @@ type endpointType = {
464432
endpoint: string?
465433
}
466434

467-
@export()
468-
@description('The type of the secrets exported to the provided Key Vault.')
469-
type secretsExportConfigurationType = {
470-
@description('Required. The key vault name where to store the keys and connection strings generated by the modules.')
471-
keyVaultResourceId: string
472-
473-
@description('Optional. The name for the accessKey1 secret to create.')
474-
accessKey1Name: string?
475-
476-
@description('Optional. The name for the accessKey2 secret to create.')
477-
accessKey2Name: string?
478-
}

avm/ptn/sa/conversation-knowledge-mining/modules/keyVaultExport.bicep

Lines changed: 0 additions & 43 deletions
This file was deleted.

avm/ptn/sa/conversation-knowledge-mining/modules/project.bicep

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ param aiServicesName string
1313
@description('Optional. Tags to be applied to the resources.')
1414
param tags object = {}
1515

16+
@description('Optional. Use this parameter to use an existing AI project resource ID from different resource group')
17+
param existingFoundryProjectResourceId string = ''
18+
19+
// // Extract components from existing AI Project Resource ID if provided
20+
var useExistingProject = !empty(existingFoundryProjectResourceId)
21+
var existingProjName = useExistingProject ? last(split(existingFoundryProjectResourceId, '/')) : ''
22+
var existingAiFoundryAiServicesSubscriptionId = useExistingProject ? split(existingFoundryProjectResourceId, '/')[2] : ''
23+
var existingAiFoundryAiServicesResourceGroupName = useExistingProject ? split(existingFoundryProjectResourceId, '/')[4] : ''
24+
var existingAiFoundryAiServicesServiceName = useExistingProject ? split(existingFoundryProjectResourceId, '/')[8] : ''
25+
// Example endpoint (only if existing project provided)
26+
var existingProjEndpoint = useExistingProject ? format('https://{0}.services.ai.azure.com/api/projects/{1}', existingAiFoundryAiServicesServiceName, existingProjName) : ''
1627
// Reference to cognitive service in current resource group for new projects
1728
resource cogServiceReference 'Microsoft.CognitiveServices/accounts@2025-06-01' existing = {
1829
name: aiServicesName
1930
}
2031

2132
// Create new AI project only if not reusing existing one
22-
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-06-01' = {
33+
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-06-01' = if(!useExistingProject) {
2334
parent: cogServiceReference
2435
name: name
2536
tags: tags
@@ -33,12 +44,18 @@ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-06-01' =
3344
}
3445
}
3546

47+
// Reference the existing AI Foundry project if reusing
48+
resource existingAiProject 'Microsoft.CognitiveServices/accounts/projects@2025-06-01' existing = if (useExistingProject){
49+
name: '${existingAiFoundryAiServicesServiceName}/${existingProjName}'
50+
scope: resourceGroup(existingAiFoundryAiServicesSubscriptionId, existingAiFoundryAiServicesResourceGroupName)
51+
}
52+
3653
@description('AI Project metadata including name, resource ID, and API endpoint.')
3754
output aiProjectInfo aiProjectOutputType = {
38-
name: aiProject.name
39-
resourceId: aiProject.id
40-
apiEndpoint: aiProject!.properties.endpoints['AI Foundry API']
41-
aiprojectSystemAssignedMIPrincipalId: aiProject!.identity.principalId
55+
name: useExistingProject ? existingProjName : aiProject.name
56+
resourceId: useExistingProject ? existingFoundryProjectResourceId : aiProject.id
57+
apiEndpoint: useExistingProject ? existingProjEndpoint : aiProject!.properties.endpoints['AI Foundry API']
58+
aiprojectSystemAssignedMIPrincipalId : useExistingProject ? existingAiProject!.identity.principalId : aiProject!.identity.principalId
4259
}
4360

4461
@export()

avm/ptn/sa/conversation-knowledge-mining/tests/e2e/sandbox/main.test.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ module testDeployment '../../../main.bicep' = [
4242
name: '${uniqueString(deployment().name, enforcedLocation)}-test-${serviceShort}-${iteration}'
4343
params: {
4444
solutionName: take('${namePrefix}${serviceShort}001', 16)
45+
location: enforcedLocation
4546
aiServiceLocation: enforcedLocation
47+
usecase: 'telecom'
4648
}
4749
}
4850
]

avm/ptn/sa/conversation-knowledge-mining/tests/e2e/waf-aligned/main.test.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ module testDeployment '../../../main.bicep' = [
4646
name: '${uniqueString(deployment().name, enforcedLocation)}-test-${serviceShort}-${iteration}'
4747
params: {
4848
solutionName: take('${namePrefix}${serviceShort}001', 16)
49+
location: enforcedLocation
4950
aiServiceLocation: enforcedLocation
51+
secondaryLocation: enforcedLocation
5052
enableScalability: true
5153
enableTelemetry: true
5254
enableMonitoring: true
5355
enablePrivateNetworking: true
5456
enableRedundancy: true
5557
vmAdminUsername: 'adminuser'
5658
vmAdminPassword: vmAdminPassword
59+
usecase: 'telecom'
5760
}
5861
}
5962
]

0 commit comments

Comments
 (0)