Skip to content

Commit 27a37e9

Browse files
committed
Bug#4991 - add Cog. Services Region to Key Vault
1 parent 9af495b commit 27a37e9

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

Deployment/bicep/deploy_azure_ai_service.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ output cogSearchOutput object = {
3434
cogServiceName:accounts_byc_cogser_name_resource.name
3535
cogServiceKey : cogServiceKey
3636
cogServiceEndpoint: accounts_byc_cogser_name_resource.properties.endpoint
37+
cogServiceRegion: accounts_byc_cogser_name_resource.location
3738
}

Deployment/bicep/deploy_keyvault.bicep

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ param cogServiceEndpoint string
8686
@secure()
8787
param cogServiceKey string
8888
param cogServiceName string
89+
param cogServiceRegion string
8990

9091
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = {
9192
name: kvName
@@ -304,6 +305,14 @@ resource cogServiceNameEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-previ
304305
}
305306
}
306307

308+
resource cogServiceRegionEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
309+
parent: keyVault
310+
name: 'COG-SERVICES-REGION'
311+
properties: {
312+
value: cogServiceRegion
313+
}
314+
}
315+
307316
resource azureSubscriptionIdEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
308317
parent: keyVault
309318
name: 'AZURE-SUBSCRIPTION-ID'

Deployment/bicep/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module keyvaultModule 'deploy_keyvault.bicep' = {
5959
cogServiceEndpoint:azAIMultiServiceAccount.outputs.cogSearchOutput.cogServiceEndpoint
6060
cogServiceName:azAIMultiServiceAccount.outputs.cogSearchOutput.cogServiceName
6161
cogServiceKey:azAIMultiServiceAccount.outputs.cogSearchOutput.cogServiceKey
62+
cogServiceRegion:azAIMultiServiceAccount.outputs.cogSearchOutput.cogServiceRegion
6263
enableSoftDelete:false
6364
}
6465
scope: resourceGroup(resourceGroup().name)

Deployment/bicep/main.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.28.1.47646",
8-
"templateHash": "12812951896050089732"
8+
"templateHash": "8858477527853866674"
99
}
1010
},
1111
"parameters": {
@@ -140,7 +140,7 @@
140140
"_generator": {
141141
"name": "bicep",
142142
"version": "0.28.1.47646",
143-
"templateHash": "13579945607876056775"
143+
"templateHash": "8537007800307151650"
144144
}
145145
},
146146
"parameters": {
@@ -191,7 +191,8 @@
191191
"value": {
192192
"cogServiceName": "[parameters('accounts_byc_cogser_name')]",
193193
"cogServiceKey": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', parameters('accounts_byc_cogser_name')), '2023-05-01').key1]",
194-
"cogServiceEndpoint": "[reference(resourceId('Microsoft.CognitiveServices/accounts', parameters('accounts_byc_cogser_name')), '2023-05-01').endpoint]"
194+
"cogServiceEndpoint": "[reference(resourceId('Microsoft.CognitiveServices/accounts', parameters('accounts_byc_cogser_name')), '2023-05-01').endpoint]",
195+
"cogServiceRegion": "[reference(resourceId('Microsoft.CognitiveServices/accounts', parameters('accounts_byc_cogser_name')), '2023-05-01', 'full').location]"
195196
}
196197
}
197198
}
@@ -342,6 +343,9 @@
342343
"cogServiceKey": {
343344
"value": "[reference(resourceId('Microsoft.Resources/deployments', 'deploy_azure_ai_service'), '2022-09-01').outputs.cogSearchOutput.value.cogServiceKey]"
344345
},
346+
"cogServiceRegion": {
347+
"value": "[reference(resourceId('Microsoft.Resources/deployments', 'deploy_azure_ai_service'), '2022-09-01').outputs.cogSearchOutput.value.cogServiceRegion]"
348+
},
345349
"enableSoftDelete": {
346350
"value": false
347351
}
@@ -353,7 +357,7 @@
353357
"_generator": {
354358
"name": "bicep",
355359
"version": "0.28.1.47646",
356-
"templateHash": "12080442094799083554"
360+
"templateHash": "12149961923112846409"
357361
}
358362
},
359363
"parameters": {
@@ -492,6 +496,9 @@
492496
},
493497
"cogServiceName": {
494498
"type": "string"
499+
},
500+
"cogServiceRegion": {
501+
"type": "string"
495502
}
496503
},
497504
"variables": {
@@ -633,6 +640,17 @@
633640
"[resourceId('Microsoft.KeyVault/vaults', parameters('kvName'))]"
634641
]
635642
},
643+
{
644+
"type": "Microsoft.KeyVault/vaults/secrets",
645+
"apiVersion": "2021-11-01-preview",
646+
"name": "[format('{0}/{1}', parameters('kvName'), 'COG-SERVICES-REGION')]",
647+
"properties": {
648+
"value": "[parameters('cogServiceRegion')]"
649+
},
650+
"dependsOn": [
651+
"[resourceId('Microsoft.KeyVault/vaults', parameters('kvName'))]"
652+
]
653+
},
636654
{
637655
"type": "Microsoft.KeyVault/vaults/secrets",
638656
"apiVersion": "2021-11-01-preview",

0 commit comments

Comments
 (0)