This commit is contained in:
Robert Outlaw 2017-05-02 16:27:41 -07:00
Родитель d628eb3df7
Коммит 147865429d
5 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -1,4 +1,4 @@
Create an [authentication file](https://github.com/Azure/azure-sdk-for-java/blob/master/AUTH.md) and export an environment variable `AZURE_AUTH_LOCATION` on the command line with the full path to the file.
Create an [authentication file](java-sdk-azure-authenticate.md#mgmt-file) and export an environment variable `AZURE_AUTH_LOCATION` on the command line with the full path to the file.
```bash
export AZURE_AUTH_LOCATION=/Users/raisa/azure.auth

Просмотреть файл

@ -57,6 +57,8 @@ This snippet uses the management libraries to create a storage account connectio
Other libraries require your application to run with a [service prinicpal](https://docs.microsoft.com/azure/active-directory/develop/active-directory-application-objects) authorizing the application to run with granted credentials. This configuration is similar to the object-based authentication steps for the management library listed below.
<a name="mgmt-auth"></a>
## Azure management libraries for Java authentication
Two options are available to authenticate your application with Azure when using the Java management libraries to create and manage resources.
@ -82,6 +84,8 @@ Azure azure = Azure
The `client`, `tenant` and `key` are the same service principal values used with file-based authentication. The `AzureEnvironment.AZURE` value creates credentials against the Azure public cloud-change this to a different `AzureEnvironment` enum if you need to access another cloud (for example, `AzureEnvironment.AZURE_GERMANY`). Read the service principal values from environment variables or a secret management store like [Key Vault](/azure/key-vault/key-vault-whatis.md). Avoid setting these values as cleartext strings in your code to prevent a leak of the credentials through your version control history.
<a name="mgmt-file"></a>
### File based authentication (Preview)
The simplest way to authenticate is to create a properties file that contains credentials for an [Azure service principal](https://docs.microsoft.com/azure/active-directory/develop/active-directory-application-objects). If you don't have a service principal created for your app yet, [create one now with the Azure CLI 2.0](/cli/azure/create-an-azure-service-principal-azure-cli).

Просмотреть файл

@ -94,6 +94,8 @@ vmToRestart.restart();
```
These methods generally do not have asynchronous versions in the management libraries.
<a name="Creatables"></a>
## Lazy resource creation
A challenge when creating Azure resources arises when a new resource depends on another resource that doesn't yet exist. An example is reserving a public IP address and setting up a disk when creating a new virtual machine. You don't want to verify reserving the address or the creating the disk, you just want to ensure the virtual machine has those resources when it is created.

Просмотреть файл

@ -66,7 +66,7 @@ This code:
0. Defines a `Disk` Creatable with a 50GB size and random name for use with a virtual machine.
0. Uses the `azure.virtualMachines().define()..create()` chain to create the Windows Server 2012 virtual machine. The API creates the `Disk` defined in the previous step the same time as the virtual machine. A 10GB data disk is also attached to the virtual machine through `withNewDataDisk(10)`.
Learn more about using [Creatables](java-sdk-azure-concepts.md#Creatables) do define local representations of resources and create them just as other Azure resources need them.
Learn more about using [Creatable<T> objects](java-sdk-azure-concepts.md#Creatables) to define local representations of resources and create them just as other Azure resources need them.
## Stop, start, and restart a virtual machine

Просмотреть файл

@ -17,7 +17,7 @@ ms.author: routlaw;asirveda
[This sample](https://github.com/Azure-Samples/compute-java-create-virtual-machines-across-regions-in-parallel) creates virtual machines in parallel across different Azure regions using the [Azure management libraries for Java](https://github.com/Azure/azure-sdk-for-java).
> [!IMPORTANT]
> The sample creates a total of 48 VMs running Ubuntu 16.04 LTS of [size STANDARD_DS3_V2](../virtual-machines/virtual-machines-windows-sizes.md) across four regions. The sample code deletes these virtual machines before exiting. Make sure to [check your service limits and quota](../azure-subscription-service-limits.md) before running this sample with the default number of VMs.
> The sample creates a total of 48 VMs running Ubuntu 16.04 LTS of [size STANDARD_DS3_V2](http://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes) across four regions. The sample code deletes these virtual machines before exiting. Make sure to [check your service limits and quota](http://docs.microsoft.com/azure/azure-subscription-service-limits) before running this sample with the default number of VMs.
## Run the sample
@ -148,7 +148,7 @@ The `azure.virtualMachines().create(creatableVirtualMachines)` call creates all
Use the returned `CreatedResources<VirtualMachine>` object to access any resources created in the Azure subscription during the the `create()` method, not just the returned `VirtualMachine` type. Cast the returned value from `createdRelatedResources()` to the correct type.
Learn more about working with `Creatables` and `CreatedResources` in our [API concepts article](java-sdk-azure-concepts.md).
Learn more about working with `Creatable<T>` and `CreatedResources` in our [library concepts article](java-sdk-azure-concepts.md).
## Delete the resource group