Skip to content

Commit

Permalink
fix(azure): use built-in policy for redis (#521)
Browse files Browse the repository at this point in the history
We used a custom access policy which is not required as Data Contributor
meets our needs.
  • Loading branch information
arealmaas authored Mar 6, 2024
1 parent 3242233 commit 2a8fa76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
13 changes: 2 additions & 11 deletions .azure/applications/web-api-eu/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,14 @@ module containerApp '../../modules/containerApp/main.bicep' = {
}
}

resource redisCustomAccessPolicy 'Microsoft.Cache/redis/accessPolicies@2023-08-01' = {
resource redisAccessPolicyAssignment 'Microsoft.Cache/redis/accessPolicyAssignments@2023-08-01' = {
parent: redis
name: containerAppName
properties: {
permissions: 'Contributor'
}
}

resource redisCustomAccessPolicyAssignment 'Microsoft.Cache/redis/accessPolicyAssignments@2023-08-01' = {
parent: redis
name: containerAppName
properties: {
accessPolicyName: containerAppName
accessPolicyName: 'Data Contributor'
objectId: containerApp.outputs.identityPrincipalId
objectIdAlias: '${containerAppName}-access-policy-redis'
}
dependsOn: [redisCustomAccessPolicy]
}

module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep' = {
Expand Down
13 changes: 2 additions & 11 deletions .azure/applications/web-api-so/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,14 @@ module containerApp '../../modules/containerApp/main.bicep' = {
}
}

resource redisCustomAccessPolicy 'Microsoft.Cache/redis/accessPolicies@2023-08-01' = {
resource redisAccessPolicyAssignment 'Microsoft.Cache/redis/accessPolicyAssignments@2023-08-01' = {
parent: redis
name: containerAppName
properties: {
permissions: 'Contributor'
}
}

resource redisCustomAccessPolicyAssignment 'Microsoft.Cache/redis/accessPolicyAssignments@2023-08-01' = {
parent: redis
name: containerAppName
properties: {
accessPolicyName: containerAppName
accessPolicyName: 'Data Contributor'
objectId: containerApp.outputs.identityPrincipalId
objectIdAlias: '${containerAppName}-access-policy-redis'
}
dependsOn: [redisCustomAccessPolicy]
}

module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep' = {
Expand Down

0 comments on commit 2a8fa76

Please sign in to comment.