Skip to content

Instantly share code, notes, and snippets.

@damienpontifex
Last active May 1, 2018 18:12
Show Gist options
  • Select an option

  • Save damienpontifex/cb4ce22ee6e861ef9f8da3d4d9cb4b07 to your computer and use it in GitHub Desktop.

Select an option

Save damienpontifex/cb4ce22ee6e861ef9f8da3d4d9cb4b07 to your computer and use it in GitHub Desktop.
# Kudos to http://www.lieben.nu/liebensraum/2017/07/transferring-a-domain-to-azure-dns-and-billing/
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DomainRegistration
$rgName = "NAME OF YOUR RESOURCE GROUP"
$ResourceLocation = "Global"
$ResourceName = "MYDOMAINNAME.NL"
$PropertiesObject = @{
'Consent' = @{
'AgreementKeys' = @("DNPA","DNTA");
'AgreedBy' = '122.13.11.20'; #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
az provider register --namespace Microsoft.DomainRegistration
RG_NAME="NAME OF YOUR RESOURCE GROUP"
RESOURCE_LOCATION="Global"
RESOURCE_NAME="MYDOMAINNAME.NL"
PROPERTIES="{ \
\"Consent\": { \
\"AgreementKeys\": [\"DNPA\",\"DNTA\"], \
\"AgreedBy\": \"122.13.11.20\", \
\"AgreedAt\": \"2017-08-23T08:37:40\" \
}, \
\"authCode\": \"DOMAIN TRANSFER CODE\", \
\"Privacy\": \"true\", \
\"autoRenew\": \"true\" \
}"
az resource create \
--name "${RESOURCE_NAME}" \
--resource-group "${RG_NAME}" \
--is-full-object --properties "${PROPERTIES}" \
--resource-type "Microsoft.DomainRegistration/domains" \
--location "${RESOURCE_LOCATION}" \
--api-version "2015-02-01"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment