Skip to content

Commit 87ec320

Browse files
committed
updating keyvault access
1 parent 8feabd4 commit 87ec320

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

tests/integration/all-resource-types/target-apim.bicep

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' = {
117117
name: 'standard'
118118
}
119119
tenantId: subscription().tenantId
120-
enableRbacAuthorization: true
120+
enableRbacAuthorization: false
121+
accessPolicies: []
121122
enableSoftDelete: true
122123
softDeleteRetentionInDays: 7
123124
}
@@ -151,14 +152,19 @@ resource apim 'Microsoft.ApiManagement/service@2025-09-01-preview' = {
151152
}
152153
}
153154

154-
// Grant APIM identity Key Vault Secrets User role for NamedValue KV ref
155-
resource kvRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
156-
name: guid(keyVault.id, apim.id, '4633458b-17de-408a-b874-0445c86b69e6')
157-
scope: keyVault
155+
resource kvAccessPolicy 'Microsoft.KeyVault/vaults/accessPolicies@2023-07-01' = {
156+
name: 'add'
157+
parent: keyVault
158158
properties: {
159-
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4633458b-17de-408a-b874-0445c86b69e6')
160-
principalId: apim.identity.principalId
161-
principalType: 'ServicePrincipal'
159+
accessPolicies: [
160+
{
161+
tenantId: subscription().tenantId
162+
objectId: apim.identity.principalId
163+
permissions: {
164+
secrets: ['get']
165+
}
166+
}
167+
]
162168
}
163169
}
164170

0 commit comments

Comments
 (0)