@@ -18,7 +18,8 @@ param sshPubKey string = ''
18
18
param location string = resourceGroup ().location
19
19
20
20
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles
21
- var blobContributor = subscriptionResourceId ('Microsoft.Authorization/roleDefinitions' , 'ba92f5b4-2d11-453d-a403-e96b0029c9fe' ) // Storage Blob Data Contributor
21
+ var acrPull = subscriptionResourceId ('Microsoft.Authorization/roleDefinitions' , '7f951dda-4ed3-4680-a7ca-43fe172d538d' )
22
+ var blobReader = subscriptionResourceId ('Microsoft.Authorization/roleDefinitions' , '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1' )
22
23
23
24
resource sa 'Microsoft.Storage/storageAccounts@2021-08-01' = if (deployResources ) {
24
25
kind : 'StorageV2'
@@ -49,21 +50,31 @@ resource usermgdid 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30'
49
50
name : baseName
50
51
}
51
52
53
+ resource acrPullContainerInstance 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (deployResources ) {
54
+ name : guid (resourceGroup ().id , acrPull , 'containerInstance' )
55
+ properties : {
56
+ principalId : deployResources ? usermgdid .properties .principalId : ''
57
+ principalType : 'ServicePrincipal'
58
+ roleDefinitionId : acrPull
59
+ }
60
+ scope : containerRegistry
61
+ }
62
+
52
63
resource blobRoleUserAssigned 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (deployResources ) {
53
64
scope : saUserAssigned
54
- name : guid (resourceGroup ().id , blobContributor , usermgdid .id )
65
+ name : guid (resourceGroup ().id , blobReader , usermgdid .id )
55
66
properties : {
56
67
principalId : deployResources ? usermgdid .properties .principalId : ''
57
68
principalType : 'ServicePrincipal'
58
- roleDefinitionId : blobContributor
69
+ roleDefinitionId : blobReader
59
70
}
60
71
}
61
72
62
73
resource blobRoleFunc 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (deployResources ) {
63
- name : guid (resourceGroup ().id , blobContributor , 'azfunc' )
74
+ name : guid (resourceGroup ().id , blobReader , 'azfunc' )
64
75
properties : {
65
76
principalId : deployResources ? azfunc .identity .principalId : ''
66
- roleDefinitionId : blobContributor
77
+ roleDefinitionId : blobReader
67
78
principalType : 'ServicePrincipal'
68
79
}
69
80
scope : sa
@@ -200,6 +211,7 @@ output AZIDENTITY_ACR_LOGIN_SERVER string = deployResources ? containerRegistry.
200
211
output AZIDENTITY_ACR_NAME string = deployResources ? containerRegistry .name : ''
201
212
output AZIDENTITY_AKS_NAME string = deployResources ? aks .name : ''
202
213
output AZIDENTITY_FUNCTION_NAME string = deployResources ? azfunc .name : ''
214
+ output AZIDENTITY_STORAGE_ID string = deployResources ? sa .id : ''
203
215
output AZIDENTITY_STORAGE_NAME string = deployResources ? sa .name : ''
204
216
output AZIDENTITY_STORAGE_NAME_USER_ASSIGNED string = deployResources ? saUserAssigned .name : ''
205
217
output AZIDENTITY_USER_ASSIGNED_IDENTITY string = deployResources ? usermgdid .id : ''
0 commit comments