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:
- Gather info or source and destination
- Remove existing registration
- Register to new subscription
- Gather info or source and destination
First thing is to get your new subscription ID
$NewSubscriptionId = “325*****-****-****-****-********432”
Connect to Azure Stack ARM endpoint
$RegistrationName = “a56*****-****-****-****-********7b1”
If the context is not correct, change to the sub where AzStack is registered
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
Set your CloudAdmin creds
$CloudAdminCred = Get-Credential -UserName azurestack\cloudadmin -Message “Enter the cloud domain credentials to access the privileged endpoint.”
Set your Privileged Endpoint Address
$PEP = “10.61.11.224”
2. Remove existing registration
Remove-AzsRegistration -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint $PEP -RegistrationName $RegistrationName
This took about 8 minutes for me
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
Set-AzsRegistration -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint $PEP -BillingModel PayAsYouUse -RegistrationName $RegistrationName
Again, this took about 8 minutes.
Check the region properties and we see the stamp is registered to the new subscription.
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