-
Notifications
You must be signed in to change notification settings - Fork 61
/
x.newCertificatewithRotation.ps1.bicep
43 lines (40 loc) · 1.89 KB
/
x.newCertificatewithRotation.ps1.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
param VaultName string = 'ACU1-PE-PST-P0-kvVLT01'
param CertName string = 'acu1-pe-pst-d1-sfm01'
param SubjectName string = 'CN=acu1-dev-sfm01.psthing.com'
param DnsNames array = [
'acu1-dev-sfm01.psthing.com'
'cu1-dev-sfm01.psthing.com'
'acu1-pe-pst-d1-sfm01.psthing.com'
]
param Force bool = false
param userAssignedIdentityName string
param now string = utcNow('F')
var boolstring = Force == false ? '$false' : '$true'
resource newCertwithRotationKV 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'newCertwithRotationKV-${CertName}'
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', userAssignedIdentityName)}': {}
}
}
location: resourceGroup().location
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '7.5.0'
arguments: ' -VaultName ${VaultName} -CertName ${CertName} -SubjectName ${SubjectName} -Force ${boolstring} -DnsNames ${join(DnsNames,'_')}'
scriptContent: loadTextContent('../bicep/loadTextContext/newCertificatewithRotation.ps1')
forceUpdateTag: now
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
timeout: 'PT8M'
}
}
output VaultNameOut string = newCertwithRotationKV.properties.outputs.VaultName
output CertNameOut string = newCertwithRotationKV.properties.outputs.CertName
output ThumbprintOut string = newCertwithRotationKV.properties.outputs.Thumbprint
output CertEnabledOut bool = newCertwithRotationKV.properties.outputs.CertEnabled
output RenewAtPercentageLifetime int = newCertwithRotationKV.properties.outputs.RenewAtPercentageLifetime
output ValidityInMonthsOut int = newCertwithRotationKV.properties.outputs.ValidityInMonths
output SubjectNameOut string = newCertwithRotationKV.properties.outputs.SubjectName
output DnsNamesOut array = newCertwithRotationKV.properties.outputs.DnsNames