Share via

Azure CLI from PowerShell

Rakesh Varade 1 Reputation point Microsoft Employee
2020-11-13T06:29:40.35+00:00

Hi,
I am trying to run below script from PowerShell. Document says modify script for PowerShell as below script is Shell Script. Please let me know what modifications are needed.
https://learn.microsoft.com/en-us/azure/virtual-machines/scripts/virtual-machines-windows-cli-sample-create-vm-quick-create?toc=/azure/virtual-machines/windows/toc.json

*#!/bin/bash

Update for your admin password

AdminPassword=ChangeYourAdminPassword1

Create a resource group.

az group create --name myResourceGroup --location westus

Create a virtual machine.

az vm create \
--resource-group myResourceGroup \
--name myVM \
--image win2016datacenter \
--admin-username azureuser \
--admin-password $AdminPassword \
--no-wait*

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 132.1K Reputation points MVP Volunteer Moderator
    2020-11-13T08:20:19.547+00:00

    At "AdminPassword=" enter a password you like. This password will be used to connect to the VM after deployment

    You should modify the values for your needs:
    --name "NameOfTheRessourceGroupOfTheVM"
    -- location "AzureRegionWhereTheVmWillBeDeployed"

    You should modify any value in the "create a virtual machine" section for your needs:
    --name "NameOfTheVM"
    -- admin-username "AdminUserName for login to the VM"


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.