Recently one of my colleague ask from me is it possible to move a Azure SQL Database (PaaS) to another subscription. When he try to move the SQL database to another subscription it throws an error as below.
The subscription ‘<SubscriptionID>’ is not registered for resource types ‘Microsoft.Sql/servers (southeastasia),Microsoft.Sql/servers/databases (southeastasia)’. (Code: MissingRegistrationsForTypes
As per the error it prompting us the relevant resource type was not registered in the subscription.
When I feather inquiring about this I got to know that this subscription is newly created and doesn’t deploy any type of resources yet. So I run the following command in the PowerShell. Note before running following command make sure you logged in to azure and select the relevant subscription.
When we run above PS command it gives the following, output may vary depend on the environment working.
So I notice that Microsoft.Sql provider namespace was not registered it to subscription, for to fix this issue run the following command.Make sure to register the relevant dependent resources to SQL database (web apps, resource group etc) as well using this method.
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Sql
After that verify that the resources are registered
After registering the relevant resources SQL DB movement work successfully.