Script to add CAA records to Azure DNS
#More info: https://geertdegraaf.nl/adding-caa-records-to-azure-dns | |
#login with Azure Account | |
Login-AzureRmAccount | |
#select subscription with Azure DNS | |
Get-AzureRmSubscription | |
Set-AzureRmContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx" | |
#List all ResourceGroups in Subscription | |
Get-AzureRmResourceGroup | |
#List all DNS zones in ResourceGroup | |
Get-AzureRmDnsZone -ResourceGroupName %ResourceGroupName% | |
#List all CAA records for DNS zone (replace DNSExample and example.com) | |
Get-AzureRmDnsRecordSet -ResourceGroupName DNSExample -ZoneName example.com -RecordType CAA | |
#Preparing | |
records | |
$caaRecords = @() | |
$caaRecords += New-AzureRmDnsRecordConfig -CaaFlag "0" -CaaTag "iodef" -CaaValue "mailto:admin@example.com" | |
$caaRecords += New-AzureRmDnsRecordConfig -CaaFlag "0" -CaaTag "issue" -CaaValue "letsencrypt.org" | |
#for wildcard uncomment next line | |
#$caaRecords += New-AzureRmDnsRecordConfig -CaaFlag "0" -CaaTag "issuewild" -CaaValue "letsencrypt.org" | |
#Adding CAA records | |
New-AzureRmDnsRecordSet -Name "@" -RecordType CAA -ZoneName "example.com" -ResourceGroupName DNSExample -Ttl 3600 -DnsRecords $caaRecords | |
#Verify CAA records are added in the DNS zone (replace DNSExample and example.com) | |
Get-AzureRmDnsRecordSet -ResourceGroupName DNSExample -ZoneName example.com -RecordType CAA |
This comment has been minimized.
This comment has been minimized.
Can you try to use Powershell ISE? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
m4udSec commentedNov 5, 2019
Hey GraafG, ive been hiitting a darn brick wall on the #Adding CAA records line tells me: Can not perform requested operation on nested resource. Parent resource 'bpcos.cf' not found...
would you lend me a helping hand trying to debug what``ve missed ?
cheers, thank you for that tutorial and code :)