How can one create a Virtual Machine in Powershell?



How can one create a Virtual Machine in Powershell?..

Answer / 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

More Microsoft Azure Interview Questions

Name three types of disks used by vms?

1 Answers  


What is Azure Search?

0 Answers  


What is a cspack ?

0 Answers  


Explain the fault domain?

0 Answers  


What are the differences between the subscription administrator and directory administrator?

0 Answers  






What are some of the Cloud services offered by Microsoft?

0 Answers   SwanSoft Technologies,


What is an Availability Set?

0 Answers  


What is hdinsight in microsoft azure?

0 Answers  


What is Redis cache in Azure?

0 Answers  


what is fabric?

0 Answers   Microsoft,


what is a worker role ?

0 Answers   Microsoft,


What is virtual machine scale sets in windows azure?

0 Answers  


Categories