Hello 01725609,
Thank you for posting your question on the Microsoft Q&A portal and for providing the detailed architecture diagram. It is very helpful for understanding your setup.
I understand you are facing an "Ingestion not allowed by policy" error when using LightIngest with a User-Assigned Managed Identity in an Azure Container App, despite having configured the necessary permissions as shown in your diagram.
The error message Ingestion with Managed_Identity '' to database ... is not allowed by policy is a strong indicator of the root cause. The empty single quotes ('') suggest that the Azure Data Explorer (ADX) ingestion service is not receiving the identity's ID. This typically happens when the authentication token is not correctly requested or presented by the client application (LightIngest).
Based on your diagram and command, the permissions appear to be correctly set. The issue is most likely in the LightIngest command itself, specifically the connection string used to authenticate with ADX.
The most reliable way to authenticate with ADX using a managed identity is to specify the ADX cluster's resource ID in the connection string. This ensures the Kusto client library requests a token for the correct audience.
- Action: Modify the connection string to include the
mi_res_idparameter. - Find your ADX Cluster Resource ID: You can find this on the Properties page of your ADX cluster in the Azure portal. It will look like this:
/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Kusto/clusters/{cluster-name}
Your new connection string should be: "https://{ingest-cluster-uri};Fed=true;mi_res_id={your-adx-cluster-resource-id}"
When running in an Azure environment like a Container App where the managed identity is already assigned, you often don't need to specify the identity's client ID in multiple command-line flags. The environment and the mi_res_id in the connection string provide enough context.
- Action: Try simplifying your command by removing the explicit
-managedIdentity,-connectToStorageWithManagedIdentity, and-ingestWithManagedIdentityflags. The tool should automatically pick up the assigned identity. - The
-sourcePathargument must still contain themanaged_identity={objectid}parameter, as this is used by the ADX service on the backend to access storage.
Here is a revised version of your command:
# Ensure you replace the placeholders with your actual values
$ingestUri = "https_ingestion_uri_of_your_cluster"
$adxResourceId = "/subscriptions/.../resourceGroups/.../providers/Microsoft.Kusto/clusters/..."
$miObjectId = "object_id_of_your_managed_identity"
$sourcePath = "https://youraccount.blob.core.windows.net/yourcontainer;managed_identity=" + $miObjectId
LightIngest "$ingestUri;Fed=true;mi_res_id=$adxResourceId" `
-sourcePath:$sourcePath `
-database:"databasename" `
-table:"tablename" `
-format:"csv" `
-pattern:"*" `
-ingestionMappingRef:"mappingname"
Your diagram indicates you have set the "ADX Managed Identity Policy". It is crucial to ensure the Object ID in this policy exactly matches the Object ID (also known as Principal ID) of your user-assigned managed identity.
- Action: Run the following command in your ADX database to double-check the policy.
.show database YourDatabaseName policy managed_identity
- Confirm that the
ObjectIdin the output matches the Object ID of your identity and thatAllowedUsagesincludesNativeIngestion..alter-merge database YourDatabaseName policy managed_identity ```json [ { "ObjectId": "your-managed-identity-object-id", "AllowedUsages": "NativeIngestion" } ] ```*
To help us further if the issue persists, could you please confirm the following?
- In your
-sourcePathargument, are you using the Object (Principal) ID of the Managed Identity for the{objectid}placeholder, or are you using the Client ID? The Object ID is required here. - Could you share the output of the
.show database YourDatabaseName policy managed_identitycommand (with the Object ID redacted if necessary)?
References
- Review the different properties, including
mi_res_id, for authenticating. - This guide provides a complete overview of the process.
- LightIngest Documentation: Use LightIngest to ingest data into Azure Data Explorer
I hope these steps help you resolve the authentication issue. Please let us know how it goes.
Please "Accept as Answer" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.
Thanks
Pratyush