To use this code, you need to export the required variable in the .bash_profile of the machine from where you want to execute this code.
----------------------------Steps to login to Auzre through terrafrom -----------------
- Create a Service profile after you login to azure with with 'az login' command' az ad sp create-for-rbac --name ServicePrincipalName
- Above command would give you output like: { "appId": "11111111-0000-0000-0000-000000000000", "displayName": "azure-cli-2017-06-05-10-41-15", "name": "http://azure-cli-2017-06-05-10-41-15", "password": "ASDF-0000-0000-0000-000000000000", "tenant": "22222222-0000-0000-0000-000000000000" } These values map to the Terraform variables like so: appId is the client_id defined above. password is the client_secret defined above. tenant is the tenant_id defined above.
- Create your own repo in github .. say yourRepo.
- Copy the code in my repo (azvmssPLWithTerraform) to your repo yourRepo.
- Update prodiver.tf with the your credentials you have creted for your azure account in step #2.
- Create a azure devops pipeline. Source code for this repo should be pointing to yourRepo.
- You are all set to use this repo.