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
Readeraccess 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/readpermission 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