2018-01-08 15:03:41 +01:00
|
|
|
Azure Compute ARM Provider
|
|
|
|
==========================
|
2016-02-11 18:43:45 -08:00
|
|
|
|
2018-01-08 15:03:41 +01:00
|
|
|
Build status for azurecompute-arm module:
|
|
|
|
[![Build Status](https://jclouds.ci.cloudbees.com/buildStatus/icon?job=jclouds/org.apache.jclouds.provider$azurecompute-arm)](https://jclouds.ci.cloudbees.com/job/jclouds/org.apache.jclouds.provider$azurecompute-arm/)
|
2016-04-06 23:16:46 +02:00
|
|
|
|
2016-02-11 18:43:45 -08:00
|
|
|
## Setting Up Test Credentials
|
|
|
|
|
|
|
|
### Create a Service Principal
|
|
|
|
|
|
|
|
Install and configure Azure CLI following these [steps](http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/).
|
|
|
|
|
|
|
|
Using the Azure CLI, run the following commands to create a service principal
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Enter your Microsoft account credentials when prompted
|
2017-10-25 15:17:39 +02:00
|
|
|
az login
|
2016-02-11 18:43:45 -08:00
|
|
|
|
|
|
|
# Set current subscription to create a service principal
|
2017-10-25 15:17:39 +02:00
|
|
|
az account set --subscription <Subscription-id>
|
2016-02-11 18:43:45 -08:00
|
|
|
|
2017-10-25 15:17:39 +02:00
|
|
|
# Create an AD application with your information.
|
|
|
|
az ad app create --display-name <name> --password <password> --homepage <home-page> --identifier-uris <identifier-uris>
|
2016-02-11 18:43:45 -08:00
|
|
|
|
2017-10-25 15:17:39 +02:00
|
|
|
# For example: az ad app create --display-name "jcloudsarm" --password abcd --homepage "https://jcloudsarm" --identifier-uris "https://jcloudsarm"
|
2016-02-11 18:43:45 -08:00
|
|
|
|
|
|
|
# Output will include a value for `Application Id`, which will be used for the live tests
|
|
|
|
|
|
|
|
# Create a Service Principal
|
2017-10-25 15:17:39 +02:00
|
|
|
az ad sp create --id <Application-id>
|
2016-02-11 18:43:45 -08:00
|
|
|
|
2016-09-28 18:20:26 +02:00
|
|
|
# Output will include a value for `Object Id`, to be used in the next step
|
2016-02-11 18:43:45 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
Run the following commands to assign roles to the service principal
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Assign roles for this service principal
|
2017-10-25 15:17:39 +02:00
|
|
|
az role assignment create --role Contributor --assignee <ObjectId>
|
2016-02-11 18:43:45 -08:00
|
|
|
```
|
|
|
|
|
2017-01-10 17:19:04 +00:00
|
|
|
Look up the the tenant Id
|
|
|
|
|
|
|
|
```bash
|
2017-10-25 15:17:39 +02:00
|
|
|
az account show
|
2017-01-10 17:19:04 +00:00
|
|
|
|
|
|
|
# output will be a JSON which will include the `Tenant id`
|
|
|
|
```
|
|
|
|
|
2016-02-11 18:43:45 -08:00
|
|
|
Verify service principal
|
|
|
|
|
|
|
|
```bash
|
2017-10-25 15:17:39 +02:00
|
|
|
az login -u <Application-id> -p <password> --service-principal --tenant <Tenant-id>
|
2016-02-11 18:43:45 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
## Run Live Tests
|
|
|
|
|
2016-05-16 18:55:01 -07:00
|
|
|
Use the following to run one live test:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mvn -Dtest=<name of the live test> \
|
|
|
|
-Dtest.azurecompute-arm.identity="<Application-id>" \
|
|
|
|
-Dtest.azurecompute-arm.credential="<password>" \
|
|
|
|
-Dtest.azurecompute-arm.endpoint="https://management.azure.com/subscriptions/<Subscription-id>" \
|
2016-09-28 18:20:26 +02:00
|
|
|
-Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token"
|
|
|
|
integration-test -Plive
|
2016-05-16 18:55:01 -07:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Use the following to run all the live tests:
|
2016-02-11 18:43:45 -08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
|
2016-04-06 23:16:46 +02:00
|
|
|
mvn clean verify -Plive \
|
2016-05-16 18:55:01 -07:00
|
|
|
-Dtest.azurecompute-arm.identity="<Application-id>"" \
|
|
|
|
-Dtest.azurecompute-arm.credential="<password>"" \
|
|
|
|
-Dtest.azurecompute-arm.endpoint="https://management.azure.com/subscriptions/<Subscription-id>"" \
|
2016-04-06 23:16:46 +02:00
|
|
|
-Dtest.oauth.endpoint=https://login.microsoftonline.com/<Tenant-id>/oauth2/token
|
2016-05-16 18:55:01 -07:00
|
|
|
|
2016-04-07 12:15:35 +02:00
|
|
|
```
|
2016-08-11 10:52:27 +02:00
|
|
|
|
|
|
|
## How to use it
|
|
|
|
|
|
|
|
Azure Compute ARM provider works exactly as any other jclouds provider.
|
|
|
|
Notice that as Azure supports dozens of locations, operations like listImages can be really time-consuming.
|
|
|
|
To limit the scope of such operations there are some additional properties you may want to use:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
jclouds.azurecompute.arm.publishers
|
|
|
|
```
|
|
|
|
which is by default `Canonical,RedHat`
|
|
|
|
|
|
|
|
and
|
|
|
|
```bash
|
|
|
|
jclouds.regions
|
|
|
|
```
|
|
|
|
which is by default `null`. If you want to target only the `north europe` region, you can use
|
|
|
|
|
|
|
|
```bash
|
|
|
|
jclouds.regions="northeurope"
|
|
|
|
```
|