These docs are for Rancher v1.5, for the current 1.6 docs, see
here. If you are looking for Rancher 2.x docs, see
here.
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.
- Select Azure Active Directory.
- Select App registrations.
- Select New application registration.
- Choose a Name, select
Web app / API
as Application Type and a Sign-on URL which can be anything in this case.
- 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:
- Open your created App registration.
- In the Settings view, open Keys.
- Enter a Key description, select an expiration time and select Save.
- 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.
- Go to More services, search for Subscriptions and open it.
- Open Access control (IAM).
- Select Add.
- For Role, select
Contributor
.
- For Select, select your created App registration name.
- Select Save.
Launching Azure Host(s)
- Provide a Name for the host(s).
- Select the number of hosts by using the slider beneath Quantity.
- Select which Region your Azure resources are part of.
- The Environment defaults to
AzurePublicCloud
but if you are using any government cloud, you should change this here.
- You can enter specific names for Availability Set and Resource Group, those will be created or re-used if they already exist.
- Supply the correct information for Subscription ID, Client ID and Client Secret as gathered above.
- Update the Network settings if you want to customize them from the default settings.
- 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.
- Select the Size of the image.
- Update the Docker port and Storage Type if they will be different from the default.
- (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.
- (Optional) In Advanced Options, customize your
docker-machine create
command with Docker engine options.
- 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.