Azure / aztfexport

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

China Azure #490

Closed m1rl0k closed 3 months ago

m1rl0k commented 9 months ago

I get errors when trying to authenticate to use tfexport against az china;

image this is without a service principal;

this is with service principal and azureprofile.json set to to use; image

obviously have set to azure china cloud, did az login.. gave owner to service principal on the sub trying to read... have tried multiple resource groups; etc what may i be missing? Any insights @magodo

magodo commented 9 months ago

@m1rl0k I've tested via the SP auth way (i.e. ARM_CLIENT_ID + ARM_CLIENT_SECRET), would you mind give that a try? Currently, I don't have an Azure China account to test the CLI auth scenario.

magodo commented 9 months ago

Update: I've successfully to make aztfexport work for China cloud via CLI auth, by the following steps:

  1. az cloud set --name AzureChinaCloud
  2. az login --service-principal <options>
  3. aztfexport <command> <options>
m1rl0k commented 9 months ago

yes thank you this worked; however we had to export arm_environment: china and then all works with your metbod