How to create cross tenant Output with Private Endpoint from Stream Analytics Job (Cluster) to an Event Hub (namespace)?

Sinipelto 0 Reputation points
2025-03-19T15:24:47.3766667+00:00

Hello Community!

I'm currently trying to set up an Event Hub (on a namespace) output which exists in another Tenant, and Directory (and of course, Subscription) for a Stream Analytics Job within a Stream Analytics Cluster.

I have verified that the output works when using the public endpoint over internet using the Event Hub connection string and access key. This works perfectly.

However, I would need to set up a private connection instead for lower latency and increased security.

I have configured a managed private endpoint for the Event Hub namespace in the Stream Analytics Cluster, which seems to have completed configuration and configured the output for the ASA job using the Managed System Identity since the Connection String doesn't seem to work in this scenario.

I have then disabled the public access to the event hub. But the Output Connection Test gives me now a "grant access denied" error.

So, the Event Hub Data Writer/Owner permission needs to be granted to the System Identity of the Stream Analytics cluster and job for the different tenant where the Event Hub is, which is not possible directly using the ASA resource GUIDs with the Role Access Management in the portal.

How should I proceed with this?

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
390 questions
{count} votes

1 answer

Sort by: Most helpful
  1. J N S S Kasyap 1,715 Reputation points Microsoft External Staff
    2025-03-21T04:52:07.32+00:00

    @Sinipelto
    A System Assigned Managed Identity (MSI) is restricted to its home Azure AD tenant and cannot be granted permissions in another tenant directly. Since Azure RBAC does not support cross-tenant role assignments for MSIs, they cannot be used to access resources in a different tenant.

    Cross-tenant access requires authentication using a Service Principal, as MSI cannot be assigned cross-tenant permissions. Since Azure Stream Analytics (ASA) does not directly support Service Principal authentication in the portal, a User-Assigned Managed Identity (UAMI) can be used as a bridge to authenticate with the Event Hub in the other tenant.

    The ASA job cannot directly use a Service Principal for authentication in the portal. Please follow the below steps:

    1. Register a Service Principal (App Registration) in the ASA tenant and generate a Client Secret.
    2. Assign the Service Principal the "Azure Event Hubs Data Sender" role in the Event Hub tenant.
    3. Use a User-Assigned Managed Identity (UAMI) in ASA and link it to the Service Principal. The ASA job should be configured to authenticate using the UAMI, which in turn uses the Service Principal’s credentials
    4. Configure the ASA job output to use the UAMI, ensuring Private Endpoint connectivity.

    Please refer the Microsoft Docs for reference:
    https://learn.microsoft.com/en-us/azure/stream-analytics/event-hubs-managed-identity
    https://learn.microsoft.com/en-us/azure/event-grid/cross-tenant-delivery-using-managed-identity

    Hope this helps. Do let us know if you any further queries. I'm happy to help further.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.