Skip to content

Instantly share code, notes, and snippets.

@Swimburger
Last active May 27, 2020 15:21
Show Gist options
  • Save Swimburger/81b48c507b03a43f94e4ab806ef56906 to your computer and use it in GitHub Desktop.
Save Swimburger/81b48c507b03a43f94e4ab806ef56906 to your computer and use it in GitHub Desktop.
(DO NOT USE, OUT OF DATE) Move Domain name registrar to Azure DNS
#Based on https://www.lieben.nu/liebensraum/2017/07/transferring-a-domain-to-azure-dns-and-billing/
Connect-AzureRmAccount
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DomainRegistration
$rgName = "MY_RESOURCE_GROUP_NAME" #Azure Resource Group to put DNS in
$ResourceName = "MY_DOMAINNAME.COM" #Your domain name
$AuthCode = "YOUR AUTH CODE" #transfer authentication code form Domain Registrar (GoDaddy)
$ResourceLocation = "Global"
$IpAddress = (Invoke-WebRequest https://itomation.ca/mypublicip).content #get your public IP
$CurrentTime = [DateTime]::UtcNow | get-date -Format "yyyy-MM-ddTHH:mm:ss" #get UTC time
$PropertiesObject = @{
'Consent' = @{
'AgreementKeys' = @("DNPA","DNTA");
'AgreedBy' = $IpAddress; #Google "What's my IP"
'AgreedAt' = $CurrentTime; #roughly the current time
};
'authCode' = $AuthCode;
'Privacy' = 'true';
'autoRenew' = 'false';
}
New-AzureRmResource `
-ResourceName $ResourceName `
-Location $ResourceLocation `
-PropertyObject $PropertiesObject `
-ResourceGroupName $rgName `
-ResourceType Microsoft.DomainRegistration/domains `
-ApiVersion 2015-02-01 -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment