use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.
the class ManageSqlDatabase method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
RestClient restClient = new RestClient.Builder().withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER).withSerializerAdapter(new AzureJacksonAdapter()).withReadTimeout(150, TimeUnit.SECONDS).withLogLevel(LogLevel.BODY).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials).build();
Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.
the class ManageSqlDatabaseInElasticPool method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
RestClient restClient = new RestClient.Builder().withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER).withSerializerAdapter(new AzureJacksonAdapter()).withReadTimeout(150, TimeUnit.SECONDS).withLogLevel(LogLevel.BODY).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials).build();
Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.
the class ManageStorageAccountAsync method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
Azure azure = Azure.configure().withLogLevel(LogLevel.BODY).authenticate(credFile).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.
the class ManageSimpleTrafficManager method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
//=============================================================
// Authenticate
//
System.out.println("AZURE_AUTH_LOCATION=" + System.getenv("AZURE_AUTH_LOCATION"));
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
Azure azure = Azure.authenticate(credFile).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.
the class ManageTrafficManager method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
//=============================================================
// Authenticate
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
Azure azure = Azure.configure().withLogLevel(LogLevel.BASIC).authenticate(credFile).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
Aggregations