Azure Stack Hub – Change Azure Subscription Registration

If you find yourself in a scenario where you need to change the registration subscription of an Azure Stack Hub deployment, the below is what you need to do to complete the task..

High level:

  1. Gather info or source and destination
  2. Remove existing registration
  3. Register to new subscription

 

  1. Gather info or source and destination

First thing is to get your new subscription ID

$NewSubscriptionId  = “325*****-****-****-****-********432”

 

Connect to Azure Stack ARM endpoint

image

$RegistrationName = “a56*****-****-****-****-********7b1”

 

 

 

image

If the context is not correct, change to the sub where AzStack is registered

image

If you’re lazy, um, I mean efficient like me, then run a quick out-gridview and select your current sub

Get-AzureRmSubscription | ogv -PassThru | Select-AzureRmSubscription

image

 

Set your CloudAdmin creds

$CloudAdminCred = Get-Credential -UserName azurestack\cloudadmin -Message “Enter the cloud domain credentials to access the privileged endpoint.”

image

image

Set your Privileged Endpoint Address

$PEP = “10.61.11.224”

 

2. Remove existing registration

Remove-AzsRegistration -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint $PEP -RegistrationName $RegistrationName

image

image

This took about 8 minutes for me

image

 

To confirm the deregistration, go check the region properties and we see our stamp is no longer registered

 

 

3. Register to new subscription

Set-AzureRmContext -SubscriptionId $NewSubscriptionId

image

 

Set-AzsRegistration -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint $PEP -BillingModel PayAsYouUse  -RegistrationName $RegistrationName

image

 

image

Again, this took about 8 minutes.

image

 

Check the region properties and we see the stamp is registered to the new subscription.

image

 

The process takes between 10 and 15 minutes. When the command completes, you see the message “Your environment is now registered and activated using the provided parameters.”

Happy Azure Stack’ing

Dan

Leave a Reply

Your email address will not be published. Required fields are marked *