Skip to content

Commit

Permalink
Add key vault role assignments for staging slot
Browse files Browse the repository at this point in the history
  • Loading branch information
wicksipedia committed Nov 21, 2023
1 parent 8c3dfd5 commit c9e0d06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
22 changes: 21 additions & 1 deletion infra/appService.bicep
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
param now string
param projectName string = 'sswwebsite'
param location string = resourceGroup().location
param tags object
Expand Down Expand Up @@ -185,5 +186,24 @@ resource appServiceAcrPullRoleAssignment 'Microsoft.Authorization/roleAssignment
}
}


module kvAppRoleAssignment 'keyVaultRoleAssignment.bicep' = {
name: 'KVRoleAssignment-${now}'
params: {
keyVaultName: keyVaultName
principalId: appService.identity.principalId
roleName: 'Key Vault Secrets User'
}
}


module kvSlotRoleAssignment 'keyVaultRoleAssignment.bicep' = {
name: 'KVRoleAssignment-${now}'
params: {
keyVaultName: keyVaultName
principalId: stagingSlot.identity.principalId
roleName: 'Key Vault Secrets User'
}
}

output appServiceHostName string = appService.properties.defaultHostName
output AppPrincipalId string = appService.identity.principalId
11 changes: 1 addition & 10 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module appInsight 'appInsight.bicep' = {
module appService 'appService.bicep' = {
name: 'appService-${now}'
params: {
now: now
projectName: projectName
location: location
tags: core
Expand All @@ -77,16 +78,6 @@ module appService 'appService.bicep' = {
}
}


module kVAppRoleAssignment 'keyVaultRoleAssignment.bicep' = {
name: 'KVRoleAssignment-${now}'
params: {
keyVaultName: keyVault.outputs.keyVaultName
principalId: appService.outputs.AppPrincipalId
roleName: 'Key Vault Secrets User'
}
}

module kVServicePrincipalRoleAssignment 'keyVaultRoleAssignment.bicep' = {
name: 'KVServicePrincipalRoleAssignment-${now}'
params: {
Expand Down

0 comments on commit c9e0d06

Please sign in to comment.