In order to run Low Priority VMs in your Spotinst account, you first need to connect your Spotinst account to your Azure account and subscription. The permissions are for one Azure Subscription for each Spotinst account.
Follow this guide in order to add Azure Credentials:
1. Create Active Directory Application and Service Principal
Need to create an Active Directory Application and Service Principal for Spotinst.
A. Go to Azure Active Directory service. Go to App Registrations and click in “New application registration”
Give a name to the app and in the sign-on url just put: https://spotinst.com and
After the app is created click on it and copy the Application ID and keep it aside
B. Now go to Keys in the app settings and create new Secret Key by inserting a key name and duration of never expires and save it. After you will save it you will see the key secret , copy it and keep it aside, it won’t appear again
C. Go back to the main options of the Active directory and go to Properties
Copy the Directory ID and keep it aside
D. Go back to the main options of the active directory and go to Custom Domains Names, and copy the primary domain name and keep it aside
2. Grant Permissions
After you created the service principal for Spotinst, you need to give it permissions of "Contributor" role for your wanted subscription.
A. Go to Subscription and click on your wanted subscription. Copy the Subscription ID and keep it aside.
B. Go to Access control (IAM) and click on Add
Choose Contributor role and choose the created app name that you create in step 1 and save.
3. Enable Batch service
Navigate to the Subscription page, and click on 'Resource Providers' tab.
Register the Microsoft.Batch provider if it is not registered already.
4. Create Batch Account
By default, Azure lets you create only 1 batch account per region, and we limit it as well. So you will need to create a batch account for each region that you want to launch VMs In. You can add additional batch account to an existing Spotinst account after this setup too, so you don’t need to create all of them now.
Go to Batch account, and click on add
Fill the name of the batch account (only lowercase characters) and the wanted region.
The batch account should be created with the default mode “batch service” so don’t change it (you can optionally choose a storage account) and click on create.
Enable Vnet and Custom Images
In case you want to use Vnet and custom images you need to create the Batch Account using the "Batch Service" that requires adding permissions to the Batch Service for the Subscription (included in the above guide)
5. Create Spotinst Account
Navigate to your Spotinst Console (or create a new account here)
Enter the following information:
- Client id - The Active Directory application id from step 1
- Client secret - The secret key that was generated for the Active Directory application in step 1.B
- Tenant Id - The Active Directory id from step 1.C
- Subscription ID - The subscription id from step 2.A
- Domain name - The Active Directory primary domain name from step 1.D
- Batch account URL - The URL for each batch account from step 4 (one per region you want to operate)