# Microsoft Azure

The Azure collector reads the encryption keys and certificates stored in your
Azure Key Vaults, so they count toward your post-quantum readiness alongside
everything else Mesh knows about.

Key Vault is where most Azure teams keep the keys that protect their data and
the certificates their services present. Each vault is managed on its own, so
there is rarely one place that shows what every vault holds and how strong it
is. Mesh reads the vaults you name and gives you one list.

## What it collects

Each row is a switch on the **Collect** step.

| What Mesh reads | What it tells you | Collected by default |
|---|---|---|
| **Keys** | The encryption keys in each vault, with their type, curve and size | Yes |
| **Certificates** | The certificates each vault manages, with their key algorithm and validity | Yes |
| **Key rotation** | Whether each key is set to renew itself, and how often | No — switch it on if you want it |
| **Storage account encryption** | How each storage account in a subscription encrypts its data | No — switch it on if you want it |
| **Container images** | The images in the container registry repositories you name, and whether each is signed | No — switch it on if you want it |

The three rows that are off by default each need an extra permission, which is
why you choose them yourself.

> **note**
Mesh reads key and certificate *metadata* — algorithm, size, validity,
rotation settings. It never reads a private key, a secret value or the
contents of a storage account, and it never creates, changes or deletes
anything in Azure.

## Before you start

Ask your Azure administrator for:

- **The directory (tenant) ID** of your organization.
- **An application registered for Mesh**: its application (client) ID and a
  client secret. How to create it is below.
- **The address of each Key Vault** you want read, for example
  `https://example-keyvault.vault.azure.net`.

If you plan to switch on storage account encryption or container images, also
have ready:

- **The subscription ID** that holds those storage accounts and registries.
- **Each container repository** you want read, as described in
  [Container images](#container-images).

You also need a Mesh administrator account that can manage connectors.

## The vaults you list decide what is found

Mesh reads only the vaults whose addresses you enter. It does not search your
subscriptions for other vaults, so a vault you leave out is not read.

> **caution**
Keys and certificates in a vault you did not list are not shown, and nothing
in Mesh can tell you they exist. If you are not sure, list every vault your
organization uses.

## Set up read-only access in Azure

Do this in the Azure portal, or ask your Azure administrator to.

### 1. Register an application for Mesh

1. Go to **Microsoft Entra ID › App registrations**, and select
   **New registration**.
2. Give it a name you will recognize, for example `Mesh crypto inventory`.
   Leave the other settings as they are, and select **Register**.
3. On the application's **Overview** page, copy the **Application (client)
   ID** and the **Directory (tenant) ID**.

### 2. Create a client secret

1. In the same application, open **Certificates & secrets**, and select
   **New client secret**.
2. Choose an expiry that suits your organization's policy, and select **Add**.
3. Copy the secret's **Value** straight away. Azure shows it only once.

> **tip**
The **Secret ID** column looks similar, but it is not the secret. Mesh needs
the **Value**.

When the secret expires, collection stops. Create a new secret before then and
enter it on the connector, as described in [Edit a connector](#edit-a-connector).

### 3. Give the application read access to each vault

How you grant access depends on the vault's permission model. You can see which
one a vault uses under **Settings › Access configuration**.

| Permission model | What to grant the application |
|---|---|
| **Azure role-based access control** | The **Key Vault Reader** role, on each vault (or on the resource group or subscription that holds them). Add it under the vault's **Access control (IAM) › Add role assignment** |
| **Vault access policy** | An access policy with **Key permissions: Get, List** and **Certificate permissions: Get, List**. Add it under the vault's **Access policies** |

Key Vault Reader can read key and certificate metadata, but cannot read secret
values or key material.

### 4. Extra access for the optional reads

Grant only what you plan to collect. A permission you leave out costs only the
row that needs it — the rest of the collection still runs.

| Switch | What to grant the application |
|---|---|
| **Key rotation** | Permission to read each key's rotation policy. With access policies, add **Key permissions: Get Rotation Policy**. With role-based access, the application needs a role that allows `Microsoft.KeyVault/vaults/keyrotationpolicies/read` — if rotation shows as not readable after the first collection, add a role that grants it |
| **Storage account encryption** | The **Reader** role on the subscription |
| **Container images** | On each registry, both the **AcrPull** role (to read the images) and the **Reader** role (to read the registry itself). If the registry uses repository-level (ABAC) permissions, AcrPull is not honored there — grant **Container Registry Repository Reader** instead of AcrPull |

> **note**
If the application cannot read a key's rotation policy, Mesh still lists the
key and shows its rotation as not readable. Keys created alongside a
certificate are renewed with that certificate, so they have no rotation policy
of their own — that is expected, not an error.

## Add the connector in Mesh

1. Select the settings icon, the gear at the top right of Mesh.

   ![The settings icon at the top right of Mesh, beside the search boxes](/img/connectors/crypto/crypto-01-settings-gear.png)

2. In **Settings**, open **Integrations**, then **Connectors**.

   ![The Settings menu with Integrations expanded and Connectors selected](/img/connectors/crypto/crypto-02-integrations-connectors.png)

3. Select **Add connector**, then **Crypto collectors**.

   ![The Add connector panel, with Crypto collectors at the top of the list](/img/connectors/crypto/crypto-03-add-connector.png)

4. Choose **Microsoft Azure**.

   ![The Crypto collectors panel, offering Kubernetes, Amazon Web Services, Microsoft Azure, Google Cloud and CrowdStrike endpoints](/img/connectors/crypto/crypto-04-crypto-collectors.png)

The wizard has six steps — **Get ready**, **Identify**, **Authenticate**,
**Collect**, **Tuning** and **Review**. The rail on the left tracks where you
are. Steps after **Authenticate** stay locked until the connection test passes.

### Step 1 — Get ready

A checklist of what to have ready. Nothing to fill in.

![Step 1, Get ready, listing the directory ID, application, secret and vault addresses to gather](/img/connectors/crypto-azure/azure-02-step1-get-ready.png)

### Step 2 — Identify

| Field | Required | What to enter |
|---|---|---|
| **Connector name** | Yes | A label of your choosing. It appears in the connector list and in reports |
| **Directory (tenant) ID** | Yes | Your directory (tenant) ID, from the application's **Overview** page |

![Step 2, Identify, with the connector name and directory ID fields](/img/connectors/crypto-azure/azure-03-step2-identify.png)

> **warning**
It identifies the source of everything Mesh reads through this connector, so it
cannot be changed later. To read a second Azure tenant, add a second
connector.

### Step 3 — Authenticate

| Field | Required | What to enter |
|---|---|---|
| **Application ID** | Yes | The application (client) ID |
| **Application secret** | Yes | The client secret's **Value**. Stored encrypted, and never shown again |
| **Key Vault addresses** | Yes | Comma-separated, each starting with `https://`, for example `https://vault-a.vault.azure.net, https://vault-b.vault.azure.net`. Copy each from the **Vault URI** on the vault's **Overview** page |

Select **Test connection**. You cannot continue until it passes.

![Step 3, Authenticate, showing a successful connection test](/img/connectors/crypto-azure/azure-04-step3-authenticate.png)

The test signs in as the application and makes a small read of the keys and
certificates in **each vault** you listed, so it also catches a vault address
that is wrong or a vault the application cannot read.

If it fails, the wizard shows the reason Azure gave.

![Step 3 reporting that Azure rejected the application](/img/connectors/crypto-azure/azure-05-step3-error.png)

In the example above Azure could not find the application in the directory,
which usually means the application ID or the directory ID was mistyped. See
[Troubleshooting](#troubleshooting) for the other messages.

> **tip**
A trailing comma, or two commas in a row, is treated as a vault with no
address. The wizard flags it before you can continue.

### Step 4 — Collect

Choose what Mesh reads. **Keys** and **Certificates** are on by default; the
other three are off until you switch them on.

![Step 4, Collect, with a switch for each Azure read. Every switch has been turned on in this example](/img/connectors/crypto-azure/azure-06-step4-collect.png)

Each row also says how Mesh knows what it reports — whether it saw the real key,
certificate or image, or read a configuration rule.

**Key rotation** is read onto each key's own record, so it applies only while
**Keys** is on. Turn **Keys** off and the rotation row is switched off with it.

### Step 5 — Tuning

| Setting | Shown when | What to enter |
|---|---|---|
| **How often should Mesh read?** | Always | Every hour by default. Every 15 minutes for vaults that change often; twice a day or once a day for fewer Azure calls |
| **Subscription ID** | **Storage account encryption** or **Container images** is on | The subscription that holds the storage accounts and registries. Shown on the **Subscriptions** page of the Azure portal |
| **Image repositories** | **Container images** is on | The repositories to read, as described below |
| **Owner tag keys** | Always (optional) | The Azure tags that name who owns each key and certificate. Leave empty to use `Owner,owner` |

![Step 5, Tuning, with the four frequency choices, the subscription ID and the image repositories](/img/connectors/crypto-azure/azure-07-step5-tuning.png)

#### Container images

Enter one entry per repository, separated by commas. Each entry has four parts,
separated by `/`:

```text
resource group/registry name/login server/repository
```

For example, a repository `payments/api` in the registry `exampleregistry`, in
the resource group `rg-prod`, is:

```text
rg-prod/exampleregistry/exampleregistry.azurecr.io/payments/api
```

The **login server** is shown on the registry's **Overview** page. An entry in
any other shape stops the connector, so the wizard checks each one before you
can continue.

#### Owner tags and scope

![Step 5, Tuning, scrolled down to the owner tag keys and the vaults Mesh will read](/img/connectors/crypto-azure/azure-08-step5-scope.png)

> **note**
`owner` and `Owner` are different tags in Azure. List them most authoritative
first, for example `Owner,team` — the first one present on a key or certificate
wins.

Mesh reads only the vaults you entered on the **Authenticate** step. This step
confirms that scope rather than widening it.

### Step 6 — Review

Check the summary, then select **Save connector**.

![Step 6, Review, summarizing the connector before saving](/img/connectors/crypto-azure/azure-09-step6-review.png)

## Check the first collection

The connector appears in the list and starts its first collection straight
away.

![The connector list showing the new Azure connector starting its first collection](/img/connectors/crypto-azure/azure-10-connector-list.png)

## Manage the connector

Everything you do to a connector after it is saved is on its row menu — the
**⋯** button at the end of its row.

![The connector row menu, open, showing View collections, Logs, Edit, Remove and Re-sync](/img/connectors/crypto-azure/azure-11-row-menu.png)

| Choose | What it does |
|---|---|
| **View collections** | A summary of the last run and what it brought back. Compare the counts with what you expect in your vaults |
| **Logs** | Every run this connector has made, newest first, with the detail of each one |
| **Edit** | Opens the connector's settings. See [Edit a connector](#edit-a-connector) |
| **Remove** | Stops the connector collecting. You are asked for a reason first |
| **Re-sync** | Starts a fresh, complete collection now instead of waiting for the next scheduled run |

A count lower than you expect is usually a vault that was not listed, or a
permission that was not granted, rather than a connection problem.

### Re-sync

Use **Re-sync** after you grant a new permission in Azure, add a vault, or
replace the secret, so you see the result without waiting for the next run.

- **The connector has to be enabled.** On a disabled connector the action is
  unavailable.
- **Nothing visible happens at once.** A message confirms the re-sync has
  started, and the result arrives when the run finishes. Open **View
  collections** or **Logs** again to see it.

### Remove

Removing a connector stops it collecting and hides it from your connector list.
Keys and certificates it already collected stay in Mesh, so your history and
reports stay accurate, and nothing is changed in Azure. To bring a removed
connector back, or to have its collected data deleted, contact Axiad support.

To pause collection without removing the connector, switch its **Status** off
instead.

## Edit a connector

Open the row menu and choose **Edit**. The settings are in three tabs, and
nothing is kept until you select **Save**.

### Connection

| Setting | Can you change it | What to know |
|---|---|---|
| **Connector name** | Yes | A label. Nothing depends on it |
| **Directory (tenant) ID** | No | To read a different tenant, add a second connector |
| **Key Vault addresses** | Yes | Adding a vault widens what the next run reads; removing one narrows it |
| **Subscription ID** | Yes | Required while **Storage account encryption** or **Container images** is on |
| **Authentication** | Yes | Select **Replace credential** and enter both the new application ID and its secret. **Keep current credential** backs out |

The secret is stored encrypted and is never shown again, so this tab shows only
the application ID.

> **caution**
The Edit panel does not check the credential. After you replace it, use
**Re-sync** to find out straight away whether it works.

### Collection

The same five switches as the **Collect** step, each with the Azure permission
it needs written beside it, and the **Image repositories** list. Changes apply
the next time Mesh reads the vaults.

### Advanced

How often Mesh reads, and the **Owner tag keys** — the same choices as the
**Tuning** step.

## Troubleshooting

| What you see | What it means |
|---|---|
| The connection test says Azure rejected the service principal | The directory ID, application ID or secret is wrong, or the secret has expired. Azure's message names which. A message containing `AADSTS700016` means the application was not found in that directory; `AADSTS7000215` means the secret is wrong |
| The test says the application is not allowed to list keys or certificates in a vault | The application has no read access to that vault. Grant it as described in [step 3](#3-give-the-application-read-access-to-each-vault). If the vault allows access only from selected networks, Mesh may also be blocked by the vault's firewall — contact Axiad support |
| The test says an address is not a Key Vault it can reach | The vault address is mistyped, or the vault was deleted. Copy the **Vault URI** from the vault's **Overview** page |
| Keys are listed, but rotation shows as not readable | The application cannot read rotation policies. See [step 4](#4-extra-access-for-the-optional-reads) |
| Storage account encryption returns nothing | The application does not have the **Reader** role on the subscription, or the subscription ID is wrong |
| Container images return nothing | The application needs both **AcrPull** (or **Container Registry Repository Reader** on a registry that uses repository-level permissions) and **Reader** on each registry. Also check each repository entry has all four parts |
| Keys and certificates arrive with no owner | They carry none of the tags in **Owner tag keys**, or the tag name differs in case |
| Fewer keys or certificates than you expect | A vault was not listed. Add it on the Edit panel's **Connection** tab, then **Re-sync** |
| Collection worked, then stopped | The client secret has expired or been deleted. Create a new one, enter it under **Replace credential**, then **Re-sync** |

If a problem persists, contact Axiad support with the connector name and the
time of the failed collection.
