Azure Resource Naming Conventions: Best Practices for Organized and Scalable Cloud Infrastructure

Lakin Mohapatra
5 min readAug 20, 2024

--

While managing resources in Microsoft Azure, having a well-defined naming convention is crucial. It helps maintain organization, ensures consistency across resources, and makes your infrastructure easier to manage, especially as it scales. In this blog post, we’ll cover general Azure resource naming rules, resource-specific conventions, and best practices to follow for your Azure environment.

General Azure Naming Rules

Before diving into specific resource types, it’s essential to understand the general naming rules that apply to most Azure resources:

  1. Use Lowercase Letters, Numbers, and Hyphens: Resource names should only contain lowercase letters, numbers, and hyphens. This avoids issues with case sensitivity and ensures uniformity across the board.
  2. Start and End with a Letter or Number: Resource names must begin and end with either a letter or a number, never with a hyphen or other special character.
  3. Avoid Consecutive Hyphens: While hyphens are allowed as separators, they should not be used consecutively to avoid unnecessary complexity in the names.
  4. Observe Maximum Lengths: The maximum length for resource names varies by resource type, but a general rule of thumb is to keep names under 24 characters. This ensures compatibility and ease of management.
  5. Use Abbreviations Wisely: Abbreviations can help keep names concise but should be clear enough that the meaning is still evident. Common abbreviations include env for environment (e.g., dev, test, prod), reg for region (e.g., eastus, westeu), app for application, and svc for service.

Resource-Specific Naming Conventions

Different Azure resources have their own naming conventions to ensure clarity and consistency. Below are some examples of common Azure resources and their recommended naming formats:

  1. Resource Groups
  • Format: rg-{app or service name}-{environment}-{region}
  • Example: rg-myapp-prod-eastus
  • Explanation: This format clearly identifies the resource group by its application or service, environment, and region.

2. App Services

  • Format: app-{app name}-{environment}-{region}-{instance number}
  • Example: app-mywebsite-dev-westeu-001
  • Explanation: Including the environment, region, and an instance number helps distinguish between multiple deployments.

3. Service Principals

  • Format: sp-{app or service name}-{purpose}-{environment}
  • Example: sp-myapp-deploy-prod
  • Explanation: This format identifies the purpose of the service principal and the environment it operates in.

3. Managed Identities

  • Format: id-{app or service name}-{purpose}-{environment}
  • Example: id-myapp-dataaccess-test
  • Explanation: Managed identities should be named to reflect their specific purpose and environment.

4. Key Vault

  • Format: kv-{app or service name}-{environment}-{region}
  • Example: kv-paymentservice-prod-eastus
  • Explanation: This convention helps quickly identify the Key Vault’s purpose and location.

5. Secrets (within Key Vault)

  • Format: secret-{app or service name}-{description}
  • Example: secret-myapp-dbconnection
  • Explanation: Secrets should be named descriptively to indicate their use within the application.

6. Storage Accounts

  • Format: st{app or service name}{environment}{region}
  • Example: stmyappdeveastus
  • Explanation: Storage account names must be globally unique and are limited to lowercase letters and numbers, making this concise format essential.

7. Azure SQL Database

  • Format: sql-{app or service name}-{environment}-{region}
  • Example: sql-customerdb-prod-westeu
  • Explanation: This format helps differentiate databases by application, environment, and region.

8. Azure Functions

  • Format: func-{app or service name}-{function name}-{environment}
  • Example: func-imageprocessor-resize-dev
  • Explanation: Including the function name helps identify specific functions within an application.

9. Azure Container Registry

  • Format: cr{app or service name}{environment}
  • Example: crmyappprod
  • Explanation: Container registry names must be globally unique and concise, adhering to the required format.

10. Virtual Networks

  • Format: vnet-{app or service name}-{environment}-{region}
  • Example: vnet-myapp-prod-eastus
  • Explanation: Virtual networks should clearly indicate their association with a specific application, environment, and region.

11. Subnets

  • Format: snet-{purpose}-{environment}
  • Example: snet-web-prod
  • Explanation: Subnet names should reflect their specific purpose within the network.

12. Network Security Groups

  • Format: nsg-{associated resource}-{environment}-{region}
  • Example: nsg-websubnet-prod-eastus
  • Explanation: NSG names should be linked to the resource they protect, indicating the environment and region.

13. Azure Cosmos DB

  • Format: cosmos-{app or service name}-{environment}-{region}
  • Example: cosmos-socialmedia-dev-westeu
  • Explanation: Naming Cosmos DB instances with this format clarifies their role and location.

14. Azure Kubernetes Service (AKS)

  • Format: aks-{app or service name}-{environment}-{region}
  • Example: aks-myapp-prod-eastus
  • Explanation: AKS clusters should be named to reflect the application they serve and their deployment location.

15. Logic Apps

  • Format: logic-{app or service name}-{process name}-{environment}
  • Example: logic-orderprocessing-emailnotification-prod
  • Explanation: Logic Apps should be named to indicate their specific process within an application.

16. Event Hubs

  • Format: evh-{app or service name}-{event type}-{environment}
  • Example: evh-telemetry-ingest-prod
  • Explanation: Event Hubs should be named based on the type of event they handle and the environment.

17. Service Bus

  • Format: sb-{app or service name}-{purpose}-{environment}
  • Example: sb-notifications-queue-dev
  • Explanation: Service Bus instances should be named to reflect their role in the application and the environment they serve.

Best Practices for Azure Naming Conventions

Adhering to best practices when developing and implementing your Azure naming convention ensures that your cloud infrastructure remains organized, scalable, and easy to manage:

  1. Consistency: Stick to your chosen naming convention across all resources and teams. Consistency helps prevent confusion and makes it easier to manage resources at scale.
  2. Documentation: Keep your naming convention documented and easily accessible to all team members. This ensures everyone is on the same page and follows the same rules.
  3. Automation: Use Azure Policy to enforce naming conventions automatically. This reduces the risk of human error and ensures that all resources follow the established guidelines.
  4. Tagging: Complement naming conventions with a comprehensive tagging strategy. Tags provide additional metadata that can be used for organization, cost management, and governance.
  5. Review and Adapt: Periodically review and adapt your naming convention as your Azure usage evolves. Your convention should be flexible enough to accommodate new resource types and changes in your infrastructure.
  6. Avoid Personally Identifiable Information (PII): Never include sensitive or personal data in resource names. This helps protect privacy and security.
  7. Consider Brevity: While names should be descriptive, also consider character limits and readability. Keeping names concise makes them easier to read and manage.
  8. Use Separators Consistently: If using hyphens as separators, use them consistently across all resource types. This helps maintain uniformity and makes resource names easier to parse.

Implementing a solid Azure naming convention is a critical step in managing a well-organized and scalable cloud infrastructure. By following the general naming rules, applying resource-specific conventions, and adhering to best practices, you can ensure that your Azure environment remains easy to navigate and manage as it grows. Consistency, documentation, and periodic review are key to a successful naming strategy.

--

--

Lakin Mohapatra

Software Engineer | Hungry coder | Proud Indian | Cyber Security Researcher | Blogger | Architect (web2 + web 3)