To change the Default URL (DNS Suffix) for your Web Sites in Windows Azure Pack, follow these simple steps;
On the computer that is hosting the Web Sites Controller, run the following Windows PowerShell command:
1 2 3 4 |
## Now Working anymore Import-Module WebSites Set-WebSitesConfig Global -DnsSuffix your-new-domain.com ## Now Working anymore |
Update (2014-07-14): It looks like the command above does not support -DnsSuffix anymore, but one of my readers has posted an alternative solution in the comments;
As an alternative you can use the following approach:
1 2 3 4 |
Import-Modules WebSites $Global = Get-WebSitesConfig -Type Global $Global.DNSSuffix = "new-domain.com" Set-WebSitesConfig -Type Global -pipelinevariable Global |
Check the change by using
1 |
get-WebSitesConfig -type Global | select DnsSuffix |
And you’ll after that also have to do this:
On your SQL Server, open Management Studio.
In the Hosting Database admin.WebSystems table, change the
PublishingDns, FtpDns, and Subdomain to your desired URLs.
Restart your AzurePack servers to make the changes apply everywhere.
Thanks Robert for clarifying and keeping us updated!
Update: Per a case I opened with Microsoft, the current way they recommend changing the suffix is to use one of the older (and deprecated) commandlets from the WebHostingSnapin.
Add-PSSnapin WebHostingSnapin
Set-HostingConfiguration -DnsSuffix “”
You still need to update the admin table as before also.
Sweet, thank you Robert! I saw that you posted in the Technet forum too, excellent.
I’ll update my blogpost.
One correction to Peter’s command: When using pipeline variables, you should not use the $. You are passing the variable name, not the variable itself. The correct line would be:
Set-WebSitesConfig -Type Global -pipelinevariable Global
For clarity, I would recommend against using a variable named “Global”
Import-Modules WebSites
$GlobalConfig = Get-WebSitesConfig -Type Global
$GlobalConfig.DNSSuffix = “new-domain.com”
Set-WebSitesConfig -Type Global -pipelinevariable GlobalConfig
Thank you for that solution Peter! Very appreciated.
As an alternative you can use the following approach:
Import-Modules WebSites
$Global = Get-WebSitesConfig -Type Global
$Global.DNSSuffix = “new-domain.com”
Set-WebSitesConfig -Type Global -pipelinevariable $Global
Check the change by using
get-WebSitesConfig -type Global | select DnsSuffix
Hi, you might be running the command on the wrong Virtual Computer.
I think it has to be done on the one with the Web Sites role “Controller”.
Try:
Import-Module WebSites
get-WebSitesConfig -type Global | select DnsSuffix
It should show you the current DnsSuffix if you are doing it on the right server.
Also, try to type the command manually without copy & paste from the web, it happens that the – is translated into a similar but slightly wider minus.
A parameter cannot be found that matches parameter name “DnsSuffix”… Any solution to this?
Nvm, was using the command on the wrong VM. Cheers!
Hi, I receive errors that Websites does not exist as a module. Is this because I am using Web Sites v2? If so, do you know how to solve this on V2? Thank you.