Setting Permissions for Scanning Azure Subscriptions
Table of Contents
For every subscription whose virtual machines and cloud services you want to import via the Azure Inventory extension, you need to set up access rights.
Permissions Required for Scanning an Azure Subscription
To configure required permissions, open Subscriptions from the Azure Portal home page and take the following steps for each subscription that will be scanned:
- Click the subscription from the list of all subscriptions.
- In the navigation pane, click Resource Providers. Check that the following resource providers are listed as registered:
- Microsoft.ClassicSubscription
- Microsoft.Subscription
- Microsoft.SqlVirtualMachine
- Microsoft.Sql
- Microsoft.Compute
- Microsoft.Resources
If any of them is not registered, run the Register action for it.
- In the navigation page for the same subscription, click Access Control.
- On the Check access tab, click Add role assignment.
- On the page that open, select Reader under Role > Job Function Roles.
- Proceed to the next page and add a user whose credentials will be used to authenticate when creating the Azure Inventory service connection.
- Proceed to the next page and click Review + assign to finish the role assignment.
On the Role assignments tab, you can see all current assignments.
Azure and VM Data Collected
| Data | Interface | Permission |
|---|---|---|
| VM list, SKUs, instance view (power state) | ARM REST: Microsoft.Compute/virtualMachines, /skus
|
Reader |
| SQL VMs | Microsoft.SqlVirtualMachine/sqlVirtualMachines |
Reader |
| Cloud services | Resource Graph: Microsoft.ResourceGraph/resources?api-version=2022-10-01
|
Reader |
| VM hardware and software inventory | Run Command, results written to blob storage | Virtual Machine Contributor |
All Azure calls use the scope https://management.azure.com/.default (set in AzureVMServiceConnectionProvider).
Additional requirements (from the existing documentation):
- Azure Service Management
user_impersonation(delegated only). - Microsoft Graph
User.Read(delegated) orUser.Read.All(application, admin consent required). - Reader on each subscription; Virtual Machine Contributor on subscriptions with VMs to scan.
- Registered resource providers:
Microsoft.ClassicSubscription,Microsoft.Subscription,Microsoft.SqlVirtualMachine,Microsoft.Sql,Microsoft.Compute,Microsoft.Resources. - Scripts and results go through a storage account container, accessed with a SAS token.
- The registered app needs client ID, tenant ID and client secret.