Adding Azure Hosts


Rancher supports provisioning Microsoft Azure hosts using Docker Machine.

Prerequisites

Before you can launch a host on Azure, you will need to gather your Subscription ID, Client ID and Client Secret. The Client ID and Client Secret are created by creating an App registration. You can find more information on this at the Microsoft documentation site.

Using the Azure portal

Go to https://portal.azure.com and login with your credentials.

Subscription ID

To retrieve the Subscription ID, go to More services, search for Subscriptions and open it. The Subscription ID should be shown in the SUBSCRIPTION ID column next to your Subscription name.

App registration

Follow the steps below to create an App registration and the corresponding Client ID and Client Secret.

  1. Select Azure Active Directory.
  2. Select App registrations.
  3. Select New application registration.
  4. Choose a Name, select Web app / API as Application Type and a Sign-on URL which can be anything in this case.
  5. Select Create.

In the App registrations view, you should see your created App registration. The value shown in the column APPLICATION ID is what you need to use as Client ID. The next step is to generate the Client Secret:

  1. Open your created App registration.
  2. In the Settings view, open Keys.
  3. Enter a Key description, select an expiration time and select Save.
  4. The generated value shown in the column Value is what you need to use as Client Secret. This value will only be shown once.

Last thing you will need to do, is assign the appropriate permissions to your App registration.

  1. Go to More services, search for Subscriptions and open it.
  2. Open Access control (IAM).
  3. Select Add.
  4. For Role, select Contributor.
  5. For Select, select your created App registration name.
  6. Select Save.

Launching Azure Host(s)

  1. Provide a Name for the host(s).
  2. Select the number of hosts by using the slider beneath Quantity.
  3. Select which Region your Azure resources are part of.
  4. The Environment defaults to AzurePublicCloud but if you are using any government cloud, you should change this here.
  5. You can enter specific names for Availability Set and Resource Group, those will be created or re-used if they already exist.
  6. Supply the correct information for Subscription ID, Client ID and Client Secret as gathered above.
  7. Update the Network settings if you want to customize them from the default settings.
  8. Select the Image that you want launched. Whatever docker-machine supports for Azure is also supported by Rancher. If you change this, don’t forget to update the SSH User to the correct value for the image.
  9. Select the Size of the image.
  10. Update the Docker port and Storage Type if they will be different from the default.
  11. (Optional) Add labels to hosts to help organize your hosts and to schedule services/load balancers or to program external DNS records using an IP other than the host IP.
  12. (Optional) In Advanced Options, customize your docker-machine create command with Docker engine options.
  13. When complete, click Create.

Once you click on create, Rancher will create the Azure virtual machine and launch the rancher-agent container. In a couple of minutes, the host will be active and available to start adding services.