'IaC Azure Automation
I would like to perform the following steps on schedule (presumably using Azure Automation):
- Provision a VM in Azure
- Run a powershell script on that VM
- Deprovision VM
Actually I have more steps but left only 3 for simplicity.
I am new to IaC and appreciate your general guidance and advice.
- Is it scope of Azure Automation or I need something else?
- I would like to code everything in text format and put in Git and update automatically via Pull Requests
- Should I use Runbooks or DSC?
- Regarding step 2, I cannot figure out how I can upload my powersehll script into newly created VM and run it locally. The script downloads some files and updates some remote resources.
Thanks, Ruslan
Solution 1:[1]
there are a lot of options and tools to achieve your goal. If you will be working strictly in the Azure cloud, The following tools are most commonly used for building an environment.
- Azure-powershell
- Azure-CLI
- ARM-templates
each of them very similar but all a little different with their own benefits to them, but they are all tools for building your virtual infrastructure. For configuring your resources there are other tools. Like you mentioned yourself, DSC is a tool to configure virtual machines.
if you are planning to use github to push your code, i would recommend using ARM-templates. You can very easily use your own or other templates by referencing in your code. However this might be the 'hardest' solution to learn and understand the syntax in comparison to the cli and powershell. But also the most frequently used.
It is possible to build your environment and configure it in the same script using the Azure-CLI, Azure-Powershell or an other opensource solution like Terraform, But this is not best practice.
A lot of starter scripts are publicly available on github and in the Microsoft docs.
if you have any specific questions you can always send me a message, i am currently working on azure automation myself.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | arthur-orbid |