How can one create a Virtual Machine in Powershell?

Answer Posted / wipro123

VM creation using Powershell:

1) create resource:
New-AzResourceGroup -Name myResourceGroup -Location EastUS

2) create to VM:
New-AzVm `
-ResourceGroupName "myResourceGroup" `
-Name "myVM" `
-Location "East US" `
-VirtualNetworkName "myVnet" `
-SubnetName "mySubnet" `
-SecurityGroupName "myNetworkSecurityGroup" `
-PublicIpAddressName "myPublicIpAddress" `
-OpenPorts 80,3389
3) connect to VM:
Get-AzPublicIpAddress -ResourceGroupName "myResourceGroup" | Select "IpAddress"

4)find out the Public IP:
mstsc /v:publicIpAddress

5) Install IIS:
Install-WindowsFeature -name Web-Server -IncludeManagementTools

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are virtual machine scale sets in Azure?

387


Explain command task in microsoft azure?

397


What are the important drawbacks of using microsoft azure?

393


Explain the Window Azure platform?

375


Explain what is federation in sql azure?

378


What is documentdb?

444


List the benefits of traffic manager?

377


What is traffic manager and how to configure it ?

417


Why was my client disconnected from the cache?

355


What is windows azure traffic manager? What are its benefits?

365


What is azure mobile engagement?

403


Why do we use Azure Active Directory?

399


Define the Azure Redis Cache?

433


what are the three types of roles in compute component in windows azure?

420


What are break-fix issues in microsoft azure?

516