-
-
Save bluedoors/db9f6a4f9bfd8f7cda0926a2419584b8 to your computer and use it in GitHub Desktop.
ACMESharp DNS Challenge with Azure DNS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Deal with the challenge for each SAN | |
$i=0 | |
foreach ($subDomain in $domains) { | |
$i++ | |
$alias = 'dns' + $i | |
New-ACMEIdentifier -Dns $subDomain -Alias $alias | |
$completedChallenge = Complete-ACMEChallenge $alias -ChallengeType dns-01 -Handler manual | |
$dnsRRName = ($completedChallenge.Challenges | Where-Object {$_.Type -eq "dns-01"}).Challenge.RecordName | |
$dnsRRName = $dnsRRName.TrimEnd(".example.com") | |
$dnsRRValue = ($completedChallenge.Challenges | Where-Object {$_.Type -eq "dns-01"}).Challenge.RecordValue | |
# Set the DNS records in Azure | |
$Records = @() | |
$Records += New-AzureRmDnsRecordConfig -Value $dnsRRValue | |
$RecordSet = New-AzureRmDnsRecordSet -Name $dnsRRName -RecordType TXT -ResourceGroupName $RGName -TTL 3600 -ZoneName "example.com" -DnsRecords $Records | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment