Create and configure several Virtual machine

New Contributor

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 (New Contributor)
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:
2. You could use Run Command feature, more info here:
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.