Azure / aztfexport

A tool to bring existing Azure resources under Terraform's management
https://azure.github.io/aztfexport/
Mozilla Public License 2.0
1.53k stars 174 forks source link

Reading different subscription than specified #499

Closed aaron-baron closed 5 months ago

aaron-baron commented 5 months ago

I have billing Admin rights on one subscription and access to read a Resource Group on another.

When I try to run "aztfexport resource "sub1" the client tries to read from sub2. I have also tried "aztfexport map map.txt" with a mapping file that specifies the resource with "sub1". Same error.

Here is the error message: "Error: reading resource group: resources.GroupsClient#Get: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailed" Message="The client
'EMAIL@EMAIL.COM' with object id 'OBJECTID' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourcegroups/read' over scope 'sub2' or the scope is invalid. If access was recently granted, please refresh your credentials."

Any solution?

magodo commented 5 months ago

Did you specify the subscription id via --subscription-id?

aaron-baron commented 5 months ago

Yes, that did fix the problem - thanks.