Hi, in this blog post, I want to show you a script that I used to implement several identical virtual machines at the same time with Azure PowerShell.

Prerequisites

This tutorial assumes that you already have a Microsoft Azure account set up and you have the PowerShell Azure module on your machine installed. If you want to know how to install the PowerShell Azure module on your machine, check out this link.

Assumptions:

  • You created a Resource Group for these resources, and the new ones deployed in this tutorial will join that group. If you want to know how to create a Resource Group, check out this link.
  • You already created the necessary Virtual Network and subnet. If you want to know how to create a Virtual Network, check out this link.

The simplest way to get started is to sign in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.

If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Once you set your default subscription, you’re ready to start.

Set the variables

Here, we define the characteristics of our environment and the resource’s properties.

Azure Resource Deployment

In this section, you create and deploy the virtual machines in Microsoft Azure with the features and properties previously declared.

Verify the deployment

As you can see, at the end of the script, a table with the result of the deployment will be displayed.

Azure Virtual Machines

If you want to know more about Azure Virtual Machines, check out this link: https://azure.microsoft.com/en-us/services/virtual-machines/