AzureEnvironment.AzureUSGovernment
(下面的第2行)指定AzureCredentials
:var servicePrincipal = new ServicePrincipalLoginInformation { ClientId = "<your-client-id>", ClientSecret = "<your-client-secret" };
var creds = new AzureCredentials(servicePrincipal, tenantId: "<your-tenant-id>", AzureEnvironment.AzureUSGovernment);
var azure = Azure.Configure().Authenticate(creds).WithDefaultSubscription();
var rgs = await azure.ResourceGroups.ListAsync();