-
Notifications
You must be signed in to change notification settings - Fork 418
Expand file tree
/
Copy pathdeploy_keyvault.bicep
More file actions
67 lines (60 loc) · 1.6 KB
/
deploy_keyvault.bicep
File metadata and controls
67 lines (60 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@minLength(3)
@maxLength(15)
@description('Solution Name')
param solutionName string
param solutionLocation string
param managedIdentityObjectId string
param keyvaultName string
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = {
name: keyvaultName
location: solutionLocation
properties: {
createMode: 'default'
accessPolicies: [
{
objectId: managedIdentityObjectId
permissions: {
certificates: [
'all'
]
keys: [
'all'
]
secrets: [
'all'
]
storage: [
'all'
]
}
tenantId: subscription().tenantId
}
]
enabledForDeployment: true
enabledForDiskEncryption: true
enabledForTemplateDeployment: true
enableRbacAuthorization: true
publicNetworkAccess: 'enabled'
sku: {
family: 'A'
name: 'standard'
}
softDeleteRetentionInDays: 7
tenantId: subscription().tenantId
}
}
@description('This is the built-in Key Vault Administrator role.')
resource kvAdminRole 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
scope: resourceGroup()
name: '00482a5a-887f-4fb3-b363-3b7fe8e74483'
}
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(resourceGroup().id, managedIdentityObjectId, kvAdminRole.id)
properties: {
principalId: managedIdentityObjectId
roleDefinitionId:kvAdminRole.id
principalType: 'ServicePrincipal'
}
}
output keyvaultName string = keyvaultName
output keyvaultId string = keyVault.id