Unable to Connect to Azure Bastion Host Due to Authorization Error

Daniel Izzudin Arshad 0 Reputation points
2025-09-09T15:09:02.42+00:00

A solution is being published in Azure Marketplace that deploys a Virtual Machine and Azure Bastion into a consumer’s subscription.

Previously, the deployment was successful in the customer’s Dev subscription without explicit read access to the existing VNET, enabling connection to the VM via Azure Bastion. However, in a deployment to the Prod subscription for the same customer, an authorization failure occurs when attempting to connect to the Bastion-hosted VM through the Azure portal.

When inspecting the network through Chrome tools, an authorization error is visible.

User's image

The error details are as follows:

"com.azure.core.management.exception.ManagementException: Status code 403, \"{\"error\":{\"code\":\"AuthorizationFailed\",\"message\":\"The client '******@any.com' with object id '326f4184-db7f-xxxx-xxxx-xxxxxxxxxxxx' does not have authorization to perform action 'Microsoft.Network/virtualNetworks/read' over scope '/subscriptions/{subscription_id}/resourceGroups/{vnet_rg}providers/Microsoft.Network/virtualNetworks/{vnet_name}' or the scope is invalid. If access was recently granted, please refresh your credentials.\"}}\"

In the previous installation on the Dev Subscription, there was also no read access to the VNET, yet the connection was successful.

Environment Details

  • VM and Bastion are deployed in the same VNET but different subnet.
  • The Bastion subnet is correctly configured (AzureBastionSubnet).
  • The same deployment template and parameters were used in both subscriptions.

Expected Behavior

Azure Bastion should allow connection to the deployed VM without requiring explicit read permissions to the entire VNET, as experienced in the Dev subscription deployment.

Actual Behavior

Connection attempts fail with a 403 AuthorizationFailed error for Microsoft.Network/virtualNetworks/read.

Azure Bastion
Azure Bastion
An Azure service that provides private and fully managed Remote Desktop Protocol (RDP) and Secure Shell (SSH) access to virtual machines.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jerald Felix 7,515 Reputation points
    2025-09-09T16:06:18.3566667+00:00

    Hello Daniel Izzudin Arshad,

    Thank you for the excellent and detailed breakdown of the issue. The authorization error you're encountering is very specific, and your investigation is pointing in the right direction.

    The core of the issue is that the user attempting to connect via Azure Bastion must have read permissions on both the Bastion host and the target Virtual Network (VNet). The error message confirms this explicitly: the client does not have authorization to perform the action Microsoft.Network/virtualNetworks/read.

    The "Dev vs. Prod" Inconsistency

    The key to understanding the discrepancy between your Dev and Prod subscriptions lies in how permissions are often configured in different environments:

    • Dev Subscription: It is highly likely that in the Dev environment, the user had implicit Reader access at a higher scope, such as the resource group or the entire subscription. This is common in less restrictive development environments. This inherited permission satisfied Bastion's requirement to read the VNet properties, so the connection worked without an explicit role assignment on the VNet itself.
    • Prod Subscription: Production environments typically follow a principle of least privilege, meaning permissions are more granular and locked down. In this case, the user likely does not have those broad, inherited permissions, which exposes the fact that the direct Microsoft.Network/virtualNetworks/read permission is missing.

    The behavior you are seeing in the Prod subscription is the correct and expected behavior. Azure Bastion needs to read the VNet's configuration to establish the connection path, and the user initiating that connection must have the rights to do so.

    The Solution

    To resolve this, you must grant the necessary permissions to the user in the production environment. You have two primary options:

    Assign the Built-in "Reader" Role (Easiest):

    Navigate to the Virtual Network resource in the Azure portal.

      Go to **Access control (IAM)**.
      
         Click **Add** > **Add role assignment**.
         
            Select the **Reader** role.
            
               Assign it to the user or group that needs to connect via Bastion.
               
               **Create a Custom Role (Least Privilege)**:
               
                  For a more granular, security-focused approach, you can create a custom role that contains *only* the required permissions for Bastion access. The essential permissions are:
                  
                        **`Microsoft.Network/virtualNetworks/read`** (as indicated by your error)
                        
                              **`Microsoft.Network/bastionHosts/read`**
                              
    

    By applying one of these role assignments, you will provide the necessary authorization for the user to read the VNet's properties, allowing the Bastion connection to proceed successfully.

    Best Regards,

    Jerald Felix


Your answer

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