How to avoid Azure assigned name to the resource that is automatically generated?

Mat CHAN 85 Reputation points
2024-01-02T16:16:01.1733333+00:00

Dear all,

Recently I tried to create an AKS cluster via Azure Portal, I tried to name the name of cluster, agent pool, dns prefix and resource group that contains all AKS infra.

However, several resources are generated and assigned to that rg automatically, for example,
Network security group and it is named "aks-agentpool-<num>-nsg", I disliked that because our company would like to have a standardized naming convention across the whole platform, would that be doable?

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,456 questions
0 comments No comments
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,811 Reputation points Microsoft Employee Moderator
    2024-01-09T05:02:03.36+00:00

    Hello, @Mat CHAN ! We received your feedback and want to make sure your question is answered.

    Several of the AKS resources are automatically named. Can those resource names be changed?

    You are able to provide your own name for the AKS node resource group, however you cannot rename AKS clusters and associated resources. This means that there you will not be able to have a standardized naming convention across the whole platform as that is not supported.

    By default, AKS names the node resource group MC_resourcegroupname_clustername_location, but you can also provide your own name. To specify your own resource group name, install the aks-preview Azure CLI extension version 0.3.2 or later. When you create an AKS cluster using the az aks create command, use the --node-resource-group parameter and specify a name for the resource group. If you use an Azure Resource Manager template to deploy an AKS cluster, you can define the resource group name using the nodeResourceGroup property.

    • The Azure resource provider automatically creates the secondary resource group.
    • You can specify a custom resource group name only when you're creating the cluster. As you work with the node resource group, keep in mind that you can't:
    • Specify an existing resource group for the node resource group.
    • Specify a different subscription for the node resource group.
    • Change the node resource group name after the cluster has been created.
    • Specify names for the managed resources within the node resource group.
    • Modify or delete Azure-created tags of managed resources within the node resource group. See additional information in the next section.

    Additional Reading:


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Mat CHAN 85 Reputation points
    2024-01-12T13:30:21.6166667+00:00

    @anrodrigues-MSFT I am pretty disappointed that we don't have full control on resource naming. But still, thanks for your reply!

    1 person found this answer helpful.
    0 comments No comments

  2. anrodrigues-MSFT 0 Reputation points Microsoft Employee
    2024-01-02T17:50:13.0433333+00:00

    Hi @Mat CHAN ,

    Thank you for your question.

    The NSG name includes "agentpool" to indicate that this NSG is created for an AKS nodepool. However, its name does not reflect a specific node pool (you can see this by comparing the random number in the NSG name and the nodepool name).

    Furthermore, please keep in mind that an AKS cluster can have multiple nodepools, which will all be utilizing the same NSG, unless they are being deployed to different subnets.

    To minimize confusion, I would suggest utilising the filtering options in the portal, to only show the needed/related resources.

    Hope this helps.

    If you have any questions, please drop a comment by tagging my userid @anrodrigues-MSFT

    If this does answer your question, please accept it as the answer as a token of appreciation.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.