> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-cloud-runtime-security/cortex-cloud-data-sources-and-connectors/vendor-specific-data-sources/microsoft/azure-event-hub/ingest-logs-from-microsoft-azure-event-hub/create-the-user-assigned-managed-identity-for-azure-event-hub.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# Create the User-Assigned Managed Identity for Azure Event Hub

Step-by-step instructions and Azure CLI examples for creating the User-Assigned Managed Identity for Azure Event Hub.

Configure a User-Assigned Managed Identity (UAMI) to enable secure, secret-less authentication between Cortex Cloud and your Azure Event Hub. This process uses workload identity federation to allow the Cortex Collector to assume the identity of the UAMI.

{% hint style="warning" %}

#### Prerequisite

Before you begin, gather the following resource details from your Azure environment:

* **Resource Group Name**: The resource group where you will create the UAMI.
* **Storage Account ID**: The full resource ID of your Azure Storage account.
* **Event Hub Namespace ID**: The full resource ID of your Event Hub namespace.
* **Event Hub Name**: The name of the specific Event Hub entity within the namespace.
* **Service Account Identifier**: In Cortex Cloud (**Settings** → **Data Sources & Integrations** → **Azure Event Hub**), go to the **Copy service account identifier** field and click **Identifier** to copy the unique ID. You will use this for the **Subject** field in Azure.
  {% endhint %}

### Configure the Managed Identity

These instructions only an example using the Azure CLI; you can create and configure this UAMI using whichever method you prefer (Azure Portal UI, Infrastructure as Code, or any other preferred option).

Set these values once in your shell. After you fill them in, every command in this guide is copy-paste-and-run.

{% hint style="warning" %}

#### Important

Run all steps in the same shell session. Step 1 additionally exports `AUDIT_UAMI_CLIENT_ID` and `AUDIT_UAMI_PRINCIPAL_ID`, which later steps rely on. If you start a new session, re-run the export block below and Step 1 before continuing.
{% endhint %}

1. **Set environment variables**. The following values are examples; replace the placeholder strings with your specific resource values.
   * The `clientId` is the application ID used by Cortex to authenticate via workload identity federation.
   * The `principalId` is the unique object ID used to bind Azure RBAC role assignments.

```
export RESOURCE_GROUP_NAME="cortex-platform-rg" # Your chosen resource group name
export AUDIT_UAMI_NAME="cortex-audit-uami" # Your chosen UAMI name
export LOCATION="eastus" # The Azure region for the UAMI
export SUBJECT_ID="" # Copy the identifier from the Cortex UI
export AUDIENCE="api://AzureADTokenExchange" # The federation audience
export STORAGE_ACCOUNT_ID="" # Resource ID of your Storage Account
export EH_NAMESPACE_ID="" # Resource ID of your Event Hub namespace
export EH_NAME="" # Name of the Event Hub entity
```

2. **Create the UAMI**.\
   The UAMI is the workload identity assumed by the Cortex Collector.

```
az identity create \
--resource-group "${RESOURCE_GROUP_NAME}" \
--name "${AUDIT_UAMI_NAME}" \
--location "${LOCATION}"
```

```
# Capture the two identifiers needed below
export AUDIT_UAMI_CLIENT_ID=$(az identity show \
--resource-group "${RESOURCE_GROUP_NAME}" \
--name "${AUDIT_UAMI_NAME}" --query clientId -o tsv)
export AUDIT_UAMI_PRINCIPAL_ID=$(az identity show \
--resource-group "${RESOURCE_GROUP_NAME}" \
--name "${AUDIT_UAMI_NAME}" --query principalId -o tsv)
```

```
echo "AUDIT_UAMI_CLIENT_ID=${AUDIT_UAMI_CLIENT_ID}"
echo "AUDIT_UAMI_PRINCIPAL_ID=${AUDIT_UAMI_PRINCIPAL_ID}"
```

3\. **Configure workload identity federation for the UAMI**.\
Configure workload identity federation to allow the Cortex Collector's Google service account to authenticate as the UAMI.

```
az identity federated-credential create \
--resource-group "${RESOURCE_GROUP_NAME}" \
--identity-name "${AUDIT_UAMI_NAME}" \
--name "cortex-audit-federated-cred" \
--issuer "https://accounts.google.com" \
--subject "${SUBJECT_ID}" \
--audiences "${AUDIENCE}"
```

4\. **Grant the UAMI Storage Blob Data Contributor on the Storage Account**.\
Grant the UAMI access to the Storage Account you provided, using its resource ID.

```
az role assignment create \
--role "Storage Blob Data Contributor" \
--assignee-object-id "${AUDIT_UAMI_PRINCIPAL_ID}" \
--assignee-principal-type ServicePrincipal \
--scope "${STORAGE_ACCOUNT_ID}"
```

5. **Grant the UAMI Azure Event Hubs Data Receiver on the Event Hub**.\
   Grant the UAMI access to the specific Event Hub entity (not the whole namespace) by scoping the role assignment to the Event Hub's resource ID.

```
EH_ID="EHNAMESPACEID/eventhubs/{EH_NAME}"
az role assignment create \
--role "Azure Event Hubs Data Receiver" \
--assignee-object-id "${AUDIT_UAMI_PRINCIPAL_ID}" \
--assignee-principal-type ServicePrincipal \
--scope "${EH_ID}"
```

6\. **Verify the role assignments** (optional).\
Confirm that both roles were assigned to the UAMI:

```
az role assignment list \
--assignee "${AUDIT_UAMI_PRINCIPAL_ID}" \
--query "[].{role:roleDefinitionName, scope:scope}" -o table
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-cloud-runtime-security/cortex-cloud-data-sources-and-connectors/vendor-specific-data-sources/microsoft/azure-event-hub/ingest-logs-from-microsoft-azure-event-hub/create-the-user-assigned-managed-identity-for-azure-event-hub.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
