Skip to content

Commit 73e4d91

Browse files
Merge pull request #24 from microsoft/azdupdates
added missing scope to some of the AVM modules
2 parents 215275e + dba7fff commit 73e4d91

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

infra/main.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,12 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.9.1
167167
zoneRedundant: false
168168
managedIdentities: managedIdentityModule
169169
}
170+
scope: resourceGroup(resourceGroup().name)
170171
}
171172

172173
module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' = {
173174
name: toLower('${prefixCleaned}database')
175+
scope: resourceGroup(resourceGroup().name)
174176
params: {
175177
// Required parameters
176178
name: toLower('${prefixCleaned}databaseAccount')
@@ -238,6 +240,7 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
238240

239241
module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
240242
name: toLower('${prefixCleaned}containerAppFrontend')
243+
scope: resourceGroup(resourceGroup().name)
241244
params: {
242245
managedIdentities: {
243246
systemAssigned: true
@@ -460,6 +463,7 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group
460463

461464
module deploymentScriptCLI 'br/public:avm/res/resources/deployment-script:0.5.1' = {
462465
name: 'deploymentScriptCLI'
466+
scope: resourceGroup(resourceGroup().name)
463467
params: {
464468
// Required parameters
465469
kind: 'AzureCLI'

infra/main.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.33.93.31351",
8-
"templateHash": "234966597453008945"
8+
"templateHash": "17542743656550028202"
99
}
1010
},
1111
"parameters": {
@@ -156,7 +156,7 @@
156156
"type": "SystemAssigned"
157157
},
158158
"properties": {
159-
"managedEnvironmentId": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]",
159+
"managedEnvironmentId": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]",
160160
"configuration": {
161161
"ingress": {
162162
"external": true,
@@ -175,7 +175,7 @@
175175
"env": [
176176
{
177177
"name": "COSMOSDB_ENDPOINT",
178-
"value": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.endpoint.value]"
178+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.endpoint.value]"
179179
},
180180
{
181181
"name": "COSMOSDB_DATABASE",
@@ -244,8 +244,8 @@
244244
},
245245
"dependsOn": [
246246
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry')]",
247-
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
248-
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
247+
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
248+
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
249249
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageNameCleanedContainer'))]"
250250
]
251251
},
@@ -969,6 +969,7 @@
969969
"type": "Microsoft.Resources/deployments",
970970
"apiVersion": "2022-09-01",
971971
"name": "[toLower(format('{0}conAppsEnv', variables('prefixCleaned')))]",
972+
"resourceGroup": "[resourceGroup().name]",
972973
"properties": {
973974
"expressionEvaluationOptions": {
974975
"scope": "inner"
@@ -1588,6 +1589,7 @@
15881589
"type": "Microsoft.Resources/deployments",
15891590
"apiVersion": "2022-09-01",
15901591
"name": "[toLower(format('{0}database', variables('prefixCleaned')))]",
1592+
"resourceGroup": "[resourceGroup().name]",
15911593
"properties": {
15921594
"expressionEvaluationOptions": {
15931595
"scope": "inner"
@@ -5404,6 +5406,7 @@
54045406
"type": "Microsoft.Resources/deployments",
54055407
"apiVersion": "2022-09-01",
54065408
"name": "[toLower(format('{0}containerAppFrontend', variables('prefixCleaned')))]",
5409+
"resourceGroup": "[resourceGroup().name]",
54075410
"properties": {
54085411
"expressionEvaluationOptions": {
54095412
"scope": "inner"
@@ -5449,7 +5452,7 @@
54495452
"value": 1
54505453
},
54515454
"environmentResourceId": {
5452-
"value": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]"
5455+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value]"
54535456
},
54545457
"name": {
54555458
"value": "[toLower(format('{0}containerFrontend', variables('prefixCleaned')))]"
@@ -6625,14 +6628,15 @@
66256628
},
66266629
"dependsOn": [
66276630
"[resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned'))))]",
6628-
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
6631+
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}conAppsEnv', variables('prefixCleaned'))))]",
66296632
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity')]"
66306633
]
66316634
},
66326635
{
66336636
"type": "Microsoft.Resources/deployments",
66346637
"apiVersion": "2022-09-01",
66356638
"name": "deploymentScriptCLI",
6639+
"resourceGroup": "[resourceGroup().name]",
66366640
"properties": {
66376641
"expressionEvaluationOptions": {
66386642
"scope": "inner"
@@ -6659,7 +6663,7 @@
66596663
}
66606664
},
66616665
"scriptContent": {
6662-
"value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.name.value, resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[0], split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[1]), reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value, reference(resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned')))), '2023-05-01', 'full').identity.principalId)]"
6666+
"value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.name.value, resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[0], split(format('{0}/00000000-0000-0000-0000-000000000002', toLower(format('{0}database', variables('prefixCleaned')))), '/')[1]), reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned')))), '2022-09-01').outputs.resourceId.value, reference(resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned')))), '2023-05-01', 'full').identity.principalId)]"
66636667
}
66646668
},
66656669
"template": {
@@ -7189,7 +7193,7 @@
71897193
},
71907194
"dependsOn": [
71917195
"[resourceId('Microsoft.App/containerApps', toLower(format('{0}containerBackend', variables('prefixCleaned'))))]",
7192-
"[resourceId('Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
7196+
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', toLower(format('{0}database', variables('prefixCleaned'))))]",
71937197
"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity')]"
71947198
]
71957199
}

0 commit comments

Comments
 (0)