Transferring a domain to Azure (dns and billing)

NOTE: this post has been superceded! Use the Microsoft AppService API to create or update your domains.

Tip: Jack Rudlin wrote a great post on using the API for this.

—-old content from here—

Lately I’ve been playing with custom domains in Azure, Microsoft has been allowing us to directly purchase domain in Azure for a while now. This leverages GoDaddy’s API, but Microsoft bills you for the domain, consolidating your domains, management and usage nicely in Azure.

The portal only allows you to purchase new domains, so how do you transfer existing domains to Azure DNS?

First you’ll need a transfer code, which you can get from your current DNS provider. Then, execute the following script:

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DomainRegistration
$ResourceLocation = "Global"
$ResourceName = "MYDOMAINNAME.NL"
$PropertiesObject = @{
'Consent' = @{
'AgreementKeys' = @("DNPA","DNTA");
'AgreedBy' = ''; #ip address you're running this script from
'AgreedAt' = '2017-17-07T08:37:40'; #roughly the current time
'authCode' = 'DOMAIN TRANSFER CODE'; #code by current domain provider
'Privacy' = 'true';
'autoRenew' = 'true';

New-AzureRmResource -ResourceName $ResourceName -Location $ResourceLocation -PropertyObject $PropertiesObject -ResourceGroupName $rgName -ResourceType Microsoft.DomainRegistration/domains -ApiVersion 2015-02-01 -Verbose

It will take a long time to run, but you’ll have a custom domain in Azure that you can now connect to websites and/or manage through AzureDNS.

Note: this only works for domains OLDER than 60 days and can take 5-7 days until the domain is usable in Azure, all domain records will be copied to an Azure DNS zone.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Voted
Newest Oldest
Inline Feedbacks
View all comments
6 years ago

Thank you for the post. I tried to use your script, but I got the error:

New-AzureRmResource : {“Code”:”BadRequest”,”Message”:”Parameter domain is null or empty.”,”Target”:null,”Details”:[{“Me
ssage”:”Parameter domain is null or empty.”},{“Code”:”BadRequest”},{“ErrorEntity”:{“ExtendedCode”:”51011″,”MessageTempl
ate”:”Parameter {0} is null or empty.”,”Parameters”:[“domain”],”Code”:”BadRequest”,”Message”:”Parameter domain is null
or empty.”}}],”Innererror”:null}

Do you have any idea what is wrong? Thx!

Niels Swimberghe
5 years ago

Good news, there’s a new UI in Advanced Management portal for Azure DNS to transfer domains in and out. I don’t seem to find any announcements about it though.

6 years ago

Hello, how do you execute this script? And I’m only replacing the information in blue? I’ve not seen much on this functionality for Azure. Is it new, being able to transfer the Domain name?

Colin Wade
Colin Wade
6 years ago

Jos, do you know if this can be done with domains of any arbitrary extension? Or only the ones that are purchasable through Azure?

.io, for example, is one that I have that I don’t think is purchasable through Azure yet.