Skip to content

Commit 279aced

Browse files
Merge pull request #224 from microsoft/psl-fixPrincipalTypeIssue
fix: add principalType as 'ServicePrincipal' for role assignments
2 parents 62bae10 + bb6780e commit 279aced

2 files changed

Lines changed: 39 additions & 27 deletions

File tree

infra/main.bicep

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ module avmKeyVault './modules/key-vault.bicep' = {
447447
{
448448
principalId: avmManagedIdentity.outputs.principalId
449449
roleDefinitionIdOrName: 'Key Vault Administrator'
450+
principalType: 'ServicePrincipal'
450451
}
451452
]
452453
enablePurgeProtection: false
@@ -503,6 +504,7 @@ module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
503504
{
504505
principalId: avmManagedIdentity.outputs.principalId
505506
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
507+
principalType: 'ServicePrincipal'
506508
}
507509
{
508510
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
@@ -598,6 +600,7 @@ module avmAiServices 'modules/account/main.bicep' = {
598600
{
599601
principalId: avmManagedIdentity.outputs.principalId
600602
roleDefinitionIdOrName: '8e3af657-a8ff-443c-a75c-2fe8c4bcb635' // Owner role
603+
principalType: 'ServicePrincipal'
601604
}
602605
{
603606
principalId: avmContainerApp.outputs.systemAssignedMIPrincipalId!
@@ -1089,14 +1092,17 @@ module avmAppConfig 'br/public:avm/res/app-configuration/configuration-store:0.6
10891092
{
10901093
principalId: avmContainerApp.outputs.?systemAssignedMIPrincipalId!
10911094
roleDefinitionIdOrName: 'App Configuration Data Reader'
1095+
principalType: 'ServicePrincipal'
10921096
}
10931097
{
10941098
principalId: avmContainerApp_API.outputs.?systemAssignedMIPrincipalId!
10951099
roleDefinitionIdOrName: 'App Configuration Data Reader'
1100+
principalType: 'ServicePrincipal'
10961101
}
10971102
{
10981103
principalId: avmContainerApp_Web.outputs.?systemAssignedMIPrincipalId!
10991104
roleDefinitionIdOrName: 'App Configuration Data Reader'
1105+
principalType: 'ServicePrincipal'
11001106
}
11011107
]
11021108
keyValues: [

infra/main.json

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
"diagnosticSettings": {
256256
"value": [
257257
{
258-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
258+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
259259
}
260260
]
261261
},
@@ -935,7 +935,7 @@
935935
"diagnosticSettings": {
936936
"value": [
937937
{
938-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
938+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
939939
}
940940
]
941941
},
@@ -1680,7 +1680,7 @@
16801680
"diagnosticSettings": {
16811681
"value": [
16821682
{
1683-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
1683+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
16841684
}
16851685
]
16861686
},
@@ -2360,7 +2360,7 @@
23602360
"diagnosticSettings": {
23612361
"value": [
23622362
{
2363-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
2363+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
23642364
}
23652365
]
23662366
},
@@ -3045,7 +3045,7 @@
30453045
"diagnosticSettings": {
30463046
"value": [
30473047
{
3048-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
3048+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
30493049
}
30503050
]
30513051
},
@@ -11024,15 +11024,15 @@
1102411024
"outputs": {
1102511025
"resourceId": {
1102611026
"type": "string",
11027-
"value": "[if(variables('useExistingWorkspace'), extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), reference('logAnalyticsWorkspace').outputs.resourceId.value)]"
11027+
"value": "[if(variables('useExistingWorkspace'), extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_new_log_analytics_workspace'), '2022-09-01').resourceId)]"
1102811028
},
1102911029
"logAnalyticsWorkspaceId": {
1103011030
"type": "string",
11031-
"value": "[if(variables('useExistingWorkspace'), reference('existingLogAnalyticsWorkspace').customerId, reference('logAnalyticsWorkspace').outputs.logAnalyticsWorkspaceId.value)]"
11031+
"value": "[if(variables('useExistingWorkspace'), reference('existingLogAnalyticsWorkspace').customerId, listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_new_log_analytics_workspace'), '2022-09-01').logAnalyticsWorkspaceId)]"
1103211032
},
1103311033
"primarySharedKey": {
1103411034
"type": "securestring",
11035-
"value": "[if(variables('useExistingWorkspace'), if(variables('useExistingWorkspace'), listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), '2020-08-01'), listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey).primarySharedKey, listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey)]"
11035+
"value": "[if(variables('useExistingWorkspace'), if(variables('useExistingWorkspace'), listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), '2020-08-01'), listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_new_log_analytics_workspace'), '2022-09-01').primarySharedKey).primarySharedKey, listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_new_log_analytics_workspace'), '2022-09-01').primarySharedKey)]"
1103611036
}
1103711037
}
1103811038
}
@@ -11055,12 +11055,12 @@
1105511055
"value": "[parameters('location')]"
1105611056
},
1105711057
"workspaceResourceId": {
11058-
"value": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
11058+
"value": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
1105911059
},
1106011060
"diagnosticSettings": {
1106111061
"value": [
1106211062
{
11063-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
11063+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
1106411064
}
1106511065
]
1106611066
},
@@ -12335,7 +12335,8 @@
1233512335
"value": [
1233612336
{
1233712337
"principalId": "[reference('avmManagedIdentity').outputs.principalId.value]",
12338-
"roleDefinitionIdOrName": "Key Vault Administrator"
12338+
"roleDefinitionIdOrName": "Key Vault Administrator",
12339+
"principalType": "ServicePrincipal"
1233912340
}
1234012341
]
1234112342
},
@@ -12368,7 +12369,7 @@
1236812369
},
1236912370
"publicNetworkAccess": "[if(parameters('enablePrivateNetworking'), createObject('value', 'Disabled'), createObject('value', 'Enabled'))]",
1237012371
"logAnalyticsWorkspaceResourceId": {
12371-
"value": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
12372+
"value": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
1237212373
},
1237312374
"networkAcls": {
1237412375
"value": {
@@ -19157,7 +19158,8 @@
1915719158
"value": [
1915819159
{
1915919160
"principalId": "[reference('avmManagedIdentity').outputs.principalId.value]",
19160-
"roleDefinitionIdOrName": "Storage Blob Data Contributor"
19161+
"roleDefinitionIdOrName": "Storage Blob Data Contributor",
19162+
"principalType": "ServicePrincipal"
1916119163
},
1916219164
{
1916319165
"roleDefinitionIdOrName": "Storage Blob Data Contributor",
@@ -24952,15 +24954,16 @@
2495224954
"diagnosticSettings": {
2495324955
"value": [
2495424956
{
24955-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
24957+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]"
2495624958
}
2495724959
]
2495824960
},
2495924961
"roleAssignments": {
2496024962
"value": [
2496124963
{
2496224964
"principalId": "[reference('avmManagedIdentity').outputs.principalId.value]",
24963-
"roleDefinitionIdOrName": "8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
24965+
"roleDefinitionIdOrName": "8e3af657-a8ff-443c-a75c-2fe8c4bcb635",
24966+
"principalType": "ServicePrincipal"
2496424967
},
2496524968
{
2496624969
"principalId": "[reference('avmContainerApp').outputs.systemAssignedMIPrincipalId.value]",
@@ -26259,7 +26262,7 @@
2625926262
"_generator": {
2626026263
"name": "bicep",
2626126264
"version": "0.36.177.2456",
26262-
"templateHash": "11270933172961789567"
26265+
"templateHash": "4128376395637895528"
2626326266
}
2626426267
},
2626526268
"definitions": {
@@ -28068,7 +28071,7 @@
2806828071
"_generator": {
2806928072
"name": "bicep",
2807028073
"version": "0.36.177.2456",
28071-
"templateHash": "9150529619101779014"
28074+
"templateHash": "1200612323329026557"
2807228075
}
2807328076
},
2807428077
"definitions": {
@@ -30643,9 +30646,9 @@
3064330646
"dependsOn": [
3064430647
"avmContainerApp",
3064530648
"avmManagedIdentity",
30649+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3064630650
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
3064730651
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]",
30648-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3064930652
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
3065030653
"avmVirtualNetwork",
3065130654
"logAnalyticsWorkspace"
@@ -33020,8 +33023,8 @@
3302033023
"value": {
3302133024
"destination": "log-analytics",
3302233025
"logAnalyticsConfiguration": {
33023-
"customerId": "[reference('logAnalyticsWorkspace').outputs.logAnalyticsWorkspaceId.value]",
33024-
"sharedKey": "[listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey]"
33026+
"customerId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').logAnalyticsWorkspaceId]",
33027+
"sharedKey": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').primarySharedKey]"
3302533028
}
3302633029
}
3302733030
},
@@ -42901,7 +42904,7 @@
4290142904
"diagnosticSettings": {
4290242905
"value": [
4290342906
{
42904-
"workspaceResourceId": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]",
42907+
"workspaceResourceId": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', 'deploy_log_analytics_workspace'), '2022-09-01').resourceId]",
4290542908
"logCategoriesAndGroups": [
4290642909
{
4290742910
"categoryGroup": "allLogs",
@@ -42919,15 +42922,18 @@
4291942922
"value": [
4292042923
{
4292142924
"principalId": "[tryGet(tryGet(reference('avmContainerApp').outputs, 'systemAssignedMIPrincipalId'), 'value')]",
42922-
"roleDefinitionIdOrName": "App Configuration Data Reader"
42925+
"roleDefinitionIdOrName": "App Configuration Data Reader",
42926+
"principalType": "ServicePrincipal"
4292342927
},
4292442928
{
4292542929
"principalId": "[tryGet(tryGet(reference('avmContainerApp_API').outputs, 'systemAssignedMIPrincipalId'), 'value')]",
42926-
"roleDefinitionIdOrName": "App Configuration Data Reader"
42930+
"roleDefinitionIdOrName": "App Configuration Data Reader",
42931+
"principalType": "ServicePrincipal"
4292742932
},
4292842933
{
4292942934
"principalId": "[tryGet(tryGet(reference('avmContainerApp_Web').outputs, 'systemAssignedMIPrincipalId'), 'value')]",
42930-
"roleDefinitionIdOrName": "App Configuration Data Reader"
42935+
"roleDefinitionIdOrName": "App Configuration Data Reader",
42936+
"principalType": "ServicePrincipal"
4293142937
}
4293242938
]
4293342939
},
@@ -42999,19 +43005,19 @@
4299943005
},
4300043006
{
4300143007
"name": "APP_STORAGE_BLOB_URL",
43002-
"value": "[reference('avmStorageAccount').outputs.serviceEndpoints.value.blob]"
43008+
"value": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', format(parameters('resourceNameFormatString'), 'st')), '2022-09-01').serviceEndpoints.blob]"
4300343009
},
4300443010
{
4300543011
"name": "APP_STORAGE_QUEUE_URL",
43006-
"value": "[reference('avmStorageAccount').outputs.serviceEndpoints.value.queue]"
43012+
"value": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', format(parameters('resourceNameFormatString'), 'st')), '2022-09-01').serviceEndpoints.queue]"
4300743013
},
4300843014
{
4300943015
"name": "APP_AI_PROJECT_ENDPOINT",
4301043016
"value": "[reference('avmAiServices').outputs.aiProjectInfo.value.apiEndpoint]"
4301143017
},
4301243018
{
4301343019
"name": "APP_COSMOS_CONNSTR",
43014-
"value": "[listOutputsWithSecureValues('avmCosmosDB', '2022-09-01').primaryReadWriteConnectionString]"
43020+
"value": "[listOutputsWithSecureValues(resourceId('Microsoft.Resources/deployments', format(parameters('resourceNameFormatString'), 'cosmos-')), '2022-09-01').primaryReadWriteConnectionString]"
4301543021
}
4301643022
]
4301743023
},

0 commit comments

Comments
 (0)