Sunday, December 16, 2018

Fixing “The subscription is not registered to use namespace” when deploying Azure Resources

Azure Kubernetes Services (AKS) allow you to run your containerized application without you having to worry about setting up your own infrastructure. It is robust cloud service offering coming with Microsoft Azure for using Kubernetes as a service. Azure DevOps is helping us achieving implementation of CI/CD pipelines for deploying containerized applications to Azure Kubernetes Services. You can use Azure Resource Manager (ARM) templates to deploy an AKS cluster in Azure. However, when deploying a AKS cluster using Azure DevOps, deployment may fail with the error message “The subscription is not registered to use namespace”. Let’s look at the reasons behind this error and how to get it fixed.

The full error message may look like below indicating specific resource provider such as “Microsoft.OperationalInsight” is not registered

At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
    Details:
    Conflict: { "error": { "code": "MissingSubscriptionRegistration", "message": "The subscription is not registered to use namespace 'Microsoft.OperationalInsights’. See
https://aka.ms/rps-not-found for how to register subscriptions.", "details": [ { "code": "MissingSubscriptionRegistration", "target": "Microsoft.OperationalInsights”, "message": "The subscription is not registered to use namespace 'Microsoft.OperationalInsights'. See https://aka.ms/rps-not-found for how to register subscriptions." } ] } } undefined
    Task failed while creating or updating the template deployment.

In the Azure DevOps pipelines the failure would be shown as an error message in the Azure Resource deployment task.

image

The reason for this error is relevant resource providers are not registered for the used Azure subscription. In order to register the resource providers, go to resource providers section of your Azure subscription. You can find list of registered and not registered resources for the subscription

Click on the “Register” to register the resource provider which is causing the error. For example, to fix the failure mentioned above, we need to register “Microsoft.OperationalInsight” resource provider.

image

With the required resource providers registered in the Azure subscription you would be able to deploy the AKS cluster using Azure DevOps pipeline using ARM template.

image

It is important to note that you may come across similar error message, while you are trying to deploy any Azure resource, given that the required providers for that particular resource are not registered for the Azure subscription, used for setting up the resource. The fix is exactly the same fix we have made in this post.

No comments:

Post a Comment