-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bicep
107 lines (100 loc) · 2.4 KB
/
main.bicep
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
param vaultName string = 'keyVault${uniqueString(resourceGroup().id)}' // must be globally unique
param location string = resourceGroup().location
param sku string = 'Standard'
param tenant string = '72f988bf-86f1-41af-91ab-2d7cd011db47' // replace with your tenantId
param accessPolicies array = [
{
tenantId: tenant
objectId: 'caeebed6-cfa8-45ff-9d8a-03dba4ef9a7d' // replace with your objectId
permissions: {
keys: [
'Get'
'List'
'Update'
'Create'
'Import'
'Delete'
'Recover'
'Backup'
'Restore'
]
secrets: [
'Get'
'List'
'Set'
'Delete'
'Recover'
'Backup'
'Restore'
]
certificates: [
'Get'
'List'
'Update'
'Create'
'Import'
'Delete'
'Recover'
'Backup'
'Restore'
'ManageContacts'
'ManageIssuers'
'GetIssuers'
'ListIssuers'
'SetIssuers'
'DeleteIssuers'
]
}
}
]
param enabledForDeployment bool = true
param enabledForTemplateDeployment bool = true
param enabledForDiskEncryption bool = true
param enableRbacAuthorization bool = false
param softDeleteRetentionInDays int = 90
param keyName string = 'prodKey'
param secretName string = 'bankAccountPassword'
param secretValue string = '12345'
param networkAcls object = {
ipRules: []
virtualNetworkRules: []
}
resource keyvault 'Microsoft.KeyVault/vaults@2019-09-01' = {
name: vaultName
location: location
properties: {
tenantId: tenant
sku: {
family: 'A'
name: sku
}
accessPolicies: accessPolicies
enabledForDeployment: enabledForDeployment
enabledForDiskEncryption: enabledForDiskEncryption
enabledForTemplateDeployment: enabledForTemplateDeployment
softDeleteRetentionInDays: softDeleteRetentionInDays
enableRbacAuthorization: enableRbacAuthorization
networkAcls: networkAcls
}
}
// create key
resource key 'Microsoft.KeyVault/vaults/keys@2019-09-01' = {
name: '${keyvault.name}/${keyName}'
properties: {
kty: 'RSA' // key type
keyOps: [
// key operations
'encrypt'
'decrypt'
]
keySize: 4096
}
}
// create secret
resource secret 'Microsoft.KeyVault/vaults/secrets@2018-02-14' = {
name: '${keyvault.name}/${secretName}'
properties: {
value: secretValue
}
}
output proxyKey object = key