Cannot start stream analytics job in Vnet (cannot acquire managed identity)

Amien Bourram 0 Reputation points
2025-02-05T00:18:00.9033333+00:00

Hello, I have set up an Azure Stream Analytics job that is injected into a virtual network (VNet). The job is connected to the following resources, all of which are linked to the VNet via private endpoints:

  1. Storage Account: I authenticate using the job's managed identity, which has been assigned the Blob Data Contributor and Table Data Contributor roles on the storage account.
  2. Event Hub (Input): I authenticate using its connection string because attempting to use the managed identity results in a "cannot acquire managed identity" error.
  3. Azure SQL Database (Output): Similarly, I authenticate using its connection string, as I encounter the same "cannot acquire managed identity" error when trying to use managed identity authentication.

Additionally, the subnet used by my Stream Analytics job is associated with a NAT Gateway.

When I start the Stream Analytics job, it runs for a short while but then fails with the following error message:

"An error has occurred while initializing the connection to Azure Storage. The following information may help diagnose the issue: Azure Storage Source: Microsoft.Streaming.ExternalServiceUtilities, Message: Wrapped Exception: No such host is known. (login.windows.net:443)."

It seems like the job cannot resolve login.windows.net, which is required for managed identity authentication.

Key Details:

  • All resources (storage account, Event Hub, and SQL Database) are linked to the VNet via private endpoints.
  • The subnet used by Stream Analytics is associated with a NAT Gateway.
  • I am not using a stream analytics cluster, the job is using the stream analytics jobs virtual network integration feature

Questions:

  1. How can I resolve this DNS issue so that login.windows.net can be accessed by my Stream Analytics job for managed identity authentication?
  2. Is there a way to fix the "cannot acquire managed identity" error for my Event Hub and SQL Database connections so I can avoid using connection strings?

Any guidance would be greatly appreciated!

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

1 answer

Sort by: Most helpful
  1. phemanth 13,900 Reputation points Microsoft Vendor
    2025-02-05T19:16:53.32+00:00

    @Amien Bourram

    Welcome to the Microsoft Q&A forum.

    It seems like you're encountering a DNS resolution issue with your Azure Stream Analytics job. Here are some steps to resolve this:

    • Ensure that your VNet has a DNS server configured that can resolve external domain names like login.windows.net. You can use Azure's default DNS or configure a custom DNS server that forwards requests to Azure's DNS.
    • Verify that your NSG rules allow outbound traffic to login.windows.net on port 443. This is crucial for managed identity authentication.
    • When using private endpoints, ensure that the DNS settings are correctly configured to resolve the private endpoint IP addresses. You might need to set up DNS forwarding or conditional forwarding to Azure's DNS servers.
    • Since your subnet is associated with a NAT Gateway, ensure that the NAT Gateway is correctly configured and operational. This will ensure that outbound traffic from your VNet is routed through a consistent public IP address.
    • Double-check that the managed identity has the necessary permissions on the resources. For the Event Hub and SQL Database, ensure that the managed identity is assigned the appropriate roles and that the resources are configured to trust the managed identity.
    • For resources like Azure Storage, Event Hub, and SQL Database, enable the "Allow trusted services" setting. This allows Azure services to access your resources securely.

    For more detailed guidance, please refer to the official documentation on connecting Stream Analytics jobs to resources in a VNet and running Stream Analytics jobs in a VNet

    I hope the above steps will resolve the issue, please do let us know if issue persists. Thank you

    0 comments No comments

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.