static void Main(string[] args) { //var location = Region.EuropeWest; string json = File.ReadAllText("azureauth.properties"); Credentials localCredentials = JsonConvert.DeserializeObject <Credentials>(json); HaAzureAutenticationModel autenticationModel = new HaAzureAutenticationModel(localCredentials.clientId, localCredentials.clientSecret, localCredentials.tenantId); AzureCredentials credentials = HaAzureAuthentication.GetAzCredentials(autenticationModel); IAzure azure = HaAzureAuthentication.GetAzManagementClient(credentials); String jsonString = null; List <HaISqlServerModel> sqlServerModels = new List <HaISqlServerModel>(); foreach (var sqlServer in azure.SqlServers.List()) { HaISqlServerModel objSqlServer = LoadSqlServerCoreProperties(azure, sqlServer); LoadSqlDatabases(azure, sqlServer, objSqlServer); //LoadSqlServerKeys(azure, sqlServer, objSqlServer); //LoadElasticPools(azure, sqlServer, objSqlServer); //LoadDnsAliases(azure, sqlServer, objSqlServer); //LoadSqlFailoverGroups(azure, sqlServer, objSqlServer); //LoadSqlEncryptionProtectors(azure, sqlServer, objSqlServer); //LoadSqlVirtualNetworkRules(azure, sqlServer, objSqlServer); //LoadSqlFirewallRules(azure, sqlServer, objSqlServer); sqlServerModels.Add(objSqlServer); } jsonString += JsonConvert.SerializeObject(sqlServerModels, Formatting.Indented); Console.WriteLine(jsonString); }
public static AzureCredentials GetAzCredentials(HaAzureAutenticationModel autenticationModel) { return(SdkContext.AzureCredentialsFactory .FromServicePrincipal(autenticationModel.ClientId, autenticationModel.ClientSecret, autenticationModel.TenantId, AzureEnvironment.AzureGlobalCloud)); }