# Azure Naming Tool

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](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](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/naming-and-tagging). *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
    

```bash
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/
```

2. Build the image
    

```bash
docker build -t azurenamingtool .
```

3. Start the container
    

```bash
docker run -d -p 8081:80 --mount source=azurenamingtoolvol,target=/app/settings azurenamingtool:latest
```

4. Log in to the UI and set the default admin password : [http://localhost:8081/](http://localhost:8081/)
    
5. Go to the Configuration page and set the Component
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1728465575117/e7877db0-40ef-4aac-8d77-eb678b92af28.png align="center")
    

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1728465719102/179f6008-86ed-4755-8c10-e2bf8c23e49c.png align="center")

---

## Build image and deploy via ArgoCD

### Push your builded image to a registry

```bash
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.

```yaml
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
```
