Azure Naming Tool

Fabrice CarrelFabrice Carrel
2 min read

Here's a very useful and official Microsoft tool to help you manage the nomenclature of all your Azure elements.

Microsoft patterns & practices : https://github.com/mspnp/AzureNamingTool

The Azure Naming Tool was created to help administrators define and manage their naming conventions, while providing a simple interface for users to generate a compliant name. The tool was developed using a naming pattern based on Microsoft's best practices. Once an administrator has defined the organizational components, users can use the tool to generate a name for the desired Azure resource.

Below is a quick guide to run and use a local Docker version of the tool for testing purpose

  1. Get the source code
wget https://github.com/mspnp/AzureNamingTool/archive/refs/tags/v4.2.1.tar.gz
tar -xvf v4.2.1.tar.gz
cd AzureNamingTool-4.2.1/src/
  1. Build the image
docker build -t azurenamingtool .
  1. Start the container
docker run -d -p 8081:80 --mount source=azurenamingtoolvol,target=/app/settings azurenamingtool:latest
  1. Log in to the UI and set the default admin password : http://localhost:8081/

  2. Go to the Configuration page and set the Component

Generate a name for a resource, below an example for a PrivateDNSZone virtualNetworkLins


Build image and deploy via ArgoCD

Push your builded image to a registry

docker build -t contoso/azurenamingtool:v4.2.1 .
docker push contoso/azurenamingtool:v4.2.1

Now that your image is accessible from a registry, add the registry to your ArgoCD server.

Below is a sample of deployment code to deploy the app using your image (you can either apply the yaml via kubectl or as a project on ArgoCD).

This deployment will deploy the app with a PV, a service and an Ingress.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: azurenamingtool-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azurenamingtool
  template:
    metadata:
      labels:
        app: azurenamingtool
    spec:
      containers:
        - name: azurenamingtool
          image: contoso/azurenamingtool:v4.2.1
          ports:
            - containerPort: 80
          volumeMounts:
            - mountPath: /app/settings
              name: settings-volume
      volumes:
        - name: settings-volume
          persistentVolumeClaim:
            claimName: azurenamingtool-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azurenamingtool-pvc
spec:
  #Specify a storageClassName or leave blank to use default one
  #storageClassName: longhorn
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: azurenamingtool-service
spec:
  type: ClusterIP # Service type for Ingress
  ports:
    - port: 80
      targetPort: 80
  selector:
    app: azurenamingtool
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: azurenamingtool-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    # Specify the URL you want the app to be accessible
    - host: azurenamingtool.contoso.domain.lan
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: azurenamingtool-service
                port:
                  number: 80
0
Subscribe to my newsletter

Read articles from Fabrice Carrel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Fabrice Carrel
Fabrice Carrel