SOLVED

Create and configure several Virtual machine

Copper Contributor

Hi
Please help to understand if it's possible to write PowerShell script for next steps.
1.Connect to Azure
2. Create Virtual machine
3. Make additional configurations into VM (by Remote PowerShell Session??) without additional direct connect to VM for switching of firewall on VM level, for example,  and etc.

3 Replies
best response confirmed by Serg08 (Copper Contributor)
Solution
Hi, if you don't want to / cannot expose your VM to the Internet (so you can connect to it from your machine) and if we exclude options like P2S VPN between your machine an Azure VNet, where your VM gets deployed, there are three options:
1. You can use a Custom script VM Extension with either a shell or a PowerShell script. The script itself could either be provided in-line or referenced via a public URI. VM Extensions are Azure resources, so they can be created programmatically in both imperative (script) and declarative (ARM JSON, Bicep, Terraform) way. More info: https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows
2. You could use Run Command feature, more info here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/run-command
3. You could use a proven Config management tool like Chef, Puppet, Ansible, etc. but this requires more infrastructure, and it is more complex to implement.
Thank you very much.
it looks it works. It's cool !
I couldn't believe that it can be so easy.
I'm glad it helped you, @Serg08. Take care.
1 best response

Accepted Solutions
best response confirmed by Serg08 (Copper Contributor)
Solution
Hi, if you don't want to / cannot expose your VM to the Internet (so you can connect to it from your machine) and if we exclude options like P2S VPN between your machine an Azure VNet, where your VM gets deployed, there are three options:
1. You can use a Custom script VM Extension with either a shell or a PowerShell script. The script itself could either be provided in-line or referenced via a public URI. VM Extensions are Azure resources, so they can be created programmatically in both imperative (script) and declarative (ARM JSON, Bicep, Terraform) way. More info: https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows
2. You could use Run Command feature, more info here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/run-command
3. You could use a proven Config management tool like Chef, Puppet, Ansible, etc. but this requires more infrastructure, and it is more complex to implement.

View solution in original post