> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Storage

> Forward env zero deployment and audit logs to an Azure Blob Storage container with an OIDC token and a Microsoft Entra ID federated credential.

env zero can write your deployment and audit logs as blobs in an [Azure Blob Storage](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction) container. env zero authenticates with an OIDC token that Microsoft Entra ID exchanges for an access token, so you don't store an Azure secret in env zero.

## Prerequisites

> [!WARNING]
>
> Creating, updating, or deleting a log forwarding integration requires the **Edit Organization Settings** permission.

* A storage account in the Azure public cloud, with a container for the logs. env zero uploads to `https://<storage account>.blob.core.windows.net`, so Azure Government and Azure China are not supported.
* A Microsoft Entra ID app registration with a federated credential for env zero. If you don't have one, [create an app registration with a federated credential](https://docs.envzero.com/guides/integrations/oidc-integrations/oidc-with-azure.md#azure-ad-app-+-federated-credential). If you already deploy to Azure with OIDC, you can reuse that app: the subject identifier is the same for your whole organization.

> [!WARNING]
>
> If you deploy with a self-hosted agent, the agent uploads the deployment logs, so it must run a version later than **v5.6.3**. Audit logs do not depend on the agent.

If the storage account's **Public network access** is **Enabled from selected virtual networks and IP addresses**, add [env zero's IP addresses](https://docs.envzero.com/guides/overview/security-overview/ip-addresses.md). With a self-hosted agent, also add the agent's outbound IP addresses. If the agent runs in Azure in the same region as the storage account, IP rules have no effect on its requests: add a [virtual network rule](https://learn.microsoft.com/en-us/azure/storage/common/storage-network-security-virtual-networks) for the agent's subnet, or a [private endpoint](https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints), instead.

## Grant the app access to the container

1. In the Azure portal, open the storage account, select **Containers**, and open the container.
2. Select **Access control (IAM)** > **Add** > **Add role assignment**.
3. Select the **Storage Blob Data Contributor** role.
4. Under **Members**, select the app registration, then click **Review + assign**.

env zero only creates blobs. It never reads, lists, or deletes them. A new role assignment can take a few minutes to take effect.

## Configure the integration

**1. Open the integration**

In your organization settings, open **Integrations** and click **Azure Storage**.

**2. Enter the storage and app details**

| Field | Value | Required |
| :- | :- | :- |
| **Storage Account Name** | The storage account that holds the container | Yes |
| **Container Name** | The container for the logs | Yes |
| **Blob Path (Optional)** | A prefix for the blob names, for example `env0/logs` | No |
| **Tenant ID** | The **Directory (tenant) ID** of the app registration | Yes |
| **Client ID** | The **Application (client) ID** of the app registration | Yes |

**3. Match the federated credential**

**JWT OIDC Sub** shows your organization's subject identifier. It must match the subject of the federated credential.

If the federated credential's audience is `api://AzureADTokenExchange` (recommended), check **Use v2 OIDC token**. If it is `https://prod.env0.com`, leave it unchecked. **Audience (aud)** shows the audience env zero sends.

**4. Choose the log types**

Check **Audit Log Forwarding**, **Deployment Logs Forwarding**, or both, and click **Integrate**.

## Configure with environment variables

To forward the deployment logs of some environments only, set these environment variables in [any scope](https://docs.envzero.com/guides/admin-guide/variables.md#variables-and-scopes-in-env-zero) instead of configuring the integration. Audit logs need the integration.

| Environment variable | Value | Required |
| :- | :- | :- |
| `ENV0_AZURE_STORAGE_LOG_ACCOUNT_NAME` | The storage account name | Yes |
| `ENV0_AZURE_STORAGE_LOG_CONTAINER_NAME` | The container name | Yes |
| `ENV0_AZURE_STORAGE_LOG_BLOB_PATH` | A prefix for the blob names | No |
| `ENV0_AZURE_STORAGE_LOG_TENANT_ID` | The **Directory (tenant) ID** of the app registration | Yes |
| `ENV0_AZURE_STORAGE_LOG_CLIENT_ID` | The **Application (client) ID** of the app registration | Yes |
| `ENV0_AZURE_STORAGE_LOG_TOKEN_FORMAT` | `v1` (default) sends the `https://prod.env0.com` audience. `v2` sends `api://AzureADTokenExchange` | No |

## Where the logs land

Each upload creates a new blob:

```text theme={null}
<blobPath>/<logType>/<YYYY>/<MM>/<DD>/<HH:mm:ss>_<5 random characters>.log
```

`<logType>` is `env0-deployments` or `env0-audits`. Without a blob path, the name starts at `<logType>`. Each line of a blob is one log entry, as a JSON object.

During a deployment, env zero uploads the logs every 10 seconds, or sooner when 2 MB of logs are waiting. env zero sends audit events in batches, every 5 minutes or every 1,000 events, so an audit event can take about 5 minutes to reach the container.

## Check that logs arrive

Run a deployment, then look in the container for new blobs under `env0-deployments/`, or under `<blobPath>/env0-deployments/` if you set a blob path.

If an upload fails, the **Azure Storage** card on the **Integrations** page shows **Integration stopped**. Hover over it to see the time and error of the last failed delivery for each log type. The warning clears after the next successful delivery, or when you save the integration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.