Add Data Discs
Using Azure Cloud Shell
Azure hosts Azure Cloud Shell, as an interactive shell environment which we can use through browser. Here, cloud Shell allows to use either bash or PowerShell to work with Azure services.
Steps to launch Azure Cloud Shell
- Select Try It in the upper-right corner of a code block. Selecting Try It doesn’t automatically copy the code to Cloud Shell.
- Go to https://shell.azure.com or select the Launch Cloud Shell button to open Cloud Shell in your browser.
- Select the Cloud Shell button on the top-right menu bar in the Azure portal.
In order to run the code in the Azure Cloud Shell following steps must be used –
- Launch Cloud Shell.
- Select the Copy button on a code block to copy the code.
- Paste the code into the Cloud Shell session with Ctrl+Shift+V on Windows and Linux, or Cmd+Shift+V on macOS.
- Press Enter to run the code.
How to add an empty disk to a virtual machine?
- Use managed disks
- For creating a disk in an Availability Zone, use New-AzDiskConfig with the -Zone parameter.
- Once we add an empty disk, it would require to initialize it. For initializing the disk, we can sign in to a VM and use disk management. In case if we have enabled WinRM and a certificate on the VM when created it, we can use remote PowerShell to initialize the disk.
- The script file can contain code to initialize the disks
- We can also attach an existing managed disk to a VM as a data disk.
Add network interfaces
Network interface enables an Azure virtual machine to communicate with internet, Azure, and on-premises resources. Such that a VM can have one or more network interfaces.
Steps to add existing network interfaces to a new VM
- While creating a virtual machine through the portal, the portal creates a network interface with default settings and attaches it to the VM.
- We cannot add existing network interfaces to a new VM, nor create a VM with multiple network interfaces, by using the Azure portal.
- Also we can do both by using the CLI or PowerShell, but we must ensure to familiarize with the constraints.
- For creating a VM with multiple network interfaces, we must also configure the operating system to use them properly after creating the VM.
How to add a network interface to an existing VM?
- Sign in to the Azure portal.
- In the search box at the top of the portal, type the name of the VM to which we want to add the network interface, or browse for the VM by selecting All services, and then Virtual machines.
- Once we have found the VM, select it such that the VM must support the number of network interfaces we want to add. To find out how many network interfaces each VM size supports, see Sizes for Linux virtual machines in Azure or Sizes for Windows virtual machines in Azure.
- Select Overview, under SETTINGS.
- Select Stop, and then wait until the Status of the VM changes to Stopped (deallocated).
- Select Networking, under SETTINGS.
- Select Attach network interface. From the list of network interfaces that aren’t currently attached to another VM, select the one you’d like to attach.
- Select OK.
- Select Overview, under SETTINGS, and then Start to start the virtual machine.
- Configure the VM operating system to use multiple network interfaces properly. Learn how to configure Linux or Windows for multiple network interfaces.
How to view network interfaces for a VM?
We can view the network interfaces attached to a VM to learn about each network interface’s configuration, and the IP addresses assigned to each network interface. Following are the steps used to view network interfaces for a VM –
- Sign in to the Azure portal with an account that is assigned the Owner, Contributor, or Network Contributor role for the subscription.
- In the box that contains the text Search resources at the top of the Azure portal, type virtual machines. When virtual machines appears in the search results, select it.
- Select the name of the VM for which we want to view network interfaces.
- In the SETTINGS section for the VM we selected, select Networking.
How to remove a network interface from a VM?
Following are the steps used to remove a network interface from a VM –
- Sign in to the Azure portal.
- In the search box at the top of the portal, search for the name of the VM that we want to remove (detach) the network interface from, or browse for the VM by selecting All services, and then Virtual machines. Once we have found the VM, select it.
- Select Overview, under SETTINGS, and then Stop. Wait until the Status of the VM changes to Stopped (deallocated).
- Select Networking, under SETTINGS.
- Select Detach network interface.
Automate Configuration Management
We shall now get started with Azure Automation state configuration and the commonly associated tasks such as creating, importing, and compiling configurations, on-boarding machines to manage, and viewing reports.
How to create a DSC configuration?
In order to create a simple DSC configuration to make sure either the presence or absence of the Web-Server Windows Feature (IIS), depending on how we assign nodes.
- Start VSCode (or any text editor).
- Type the following text to be executed –
- Save the file as
TestConfig.ps1
.
How to import a configuration into Azure Automation?
- Sign in to the Azure portal.
- On the left, click All resources and then the name of the Automation account.
- On the Automation account page, select State configuration (DSC) under Configuration Management.
- On the State configuration (DSC) page, click the Configurations tab, then click + Add.
- On the Import Configuration page, browse to the TestConfig.ps1 file on the computer.
- Click OK
How to view a configuration in Azure Automation?
Once we have imported a configuration, we can view it in the Azure portal –
- Sign in to the Azure portal.
- On the left, click All resources and then the name of your Automation account.
- On the Automation account page, select State configuration (DSC) under Configuration Management.
- On the State configuration (DSC) page, click the Configurations tab, then click TestConfig
- On the TestConfig Configuration page, click View configuration source.
How to compile a configuration in Azure Automation?
- Sign in to the Azure portal.
- On the left, click All resources and then the name of the Automation account.
- On the Automation account page, click State configuration (DSC) under Configuration Management.
- On the State configuration (DSC) page, click the Configurations tab, then click TestConfig.
- On the TestConfig Configuration page, click Compile, and then click Yes. This starts a compilation job.
Manage VM sizes
We shall now discuss the available sizes and options for the Azure virtual machines that we can use to run the Windows apps and workloads.
Type | Sizes | Description |
---|---|---|
General purpose | B, Dsv3, Dv3, Dasv3, Dav3, DSv2, Dv2, Av2, DC | Balanced CPU-to-memory ratio. Ideal for testing and development, small to medium databases, and low to medium traffic web servers. |
Compute optimized | Fsv2 | High CPU-to-memory ratio. Good for medium traffic web servers, network appliances, batch processes, and application servers. |
Memory optimized | Esv3, Ev3, Easv3, Eav3, Mv2, M, DSv2, Dv2 | High memory-to-CPU ratio. Great for relational database servers, medium to large caches, and in-memory analytics. |
Storage optimized | Lsv2 | High disk throughput and IO ideal for Big Data, SQL, NoSQL databases, data warehousing and large transactional databases. |
GPU | NC, NCv2, NCv3, ND, NDv2 (Preview), NV, NVv3 (Preview) | Specialized virtual machines targeted for heavy graphic rendering and video editing, as well as model training and inferencing (ND) with deep learning. Available with single or multiple GPUs. |
High performance compute | HB, HC, H | Our fastest and most powerful CPU virtual machines with optional high-throughput network interfaces (RDMA). |
Move VMs from one resource group to another
We shall now discuss to move a Windows VM to another Azure subscription or resource group.
How to use the Azure portal to move a VM to a different subscription?
Following are the steps used to move a VM and its associated resources to a different subscription by using the Azure portal.
- Open the Azure portal.
- Click Browse > Resource groups and select the resource group containing the VM that we would like to move.
- At the top of the page for the resource group, select Move and then select Move to another subscription. The Move resources page opens.
- Select each of the resources to move. In most cases, we should move all of the related resources that are listed.
- Select the Subscription where we want the VM to be moved.
- Select an existing Resource group, or enter a name to have a new resource group created.
- When we are done, select that we understand that new resource IDs will be created and that the new IDs will need to be used with the VM after it is moved, and then select OK.
How to use the Azure portal to move a VM to another resource group?
We can move a VM and its associated resources to another resource group by using the Azure portal.
- Open the Azure portal.
- Click Browse > Virtual machines and select the VM we would like to move from the list.
- In the page for the VM, next to the label for resource group, select Change.
- Select each of the resources to move.
- Select an existing Resource group, or enter a name to have a new resource group created.
- Once we are done, select that we understand that new resource IDs will be created and that the new IDs will need to be used with the VM after it is moved, and then select OK.
Redeploy VMs
While we face difficulties troubleshooting Remote Desktop (RDP) connection or application access to Windows-based Azure virtual machine (VM), redeploying the VM may be of assistance. Now, when we redeploy a VM, Azure will shut down the VM, move the VM to a new node within the Azure infrastructure, and then power it back on, retaining all the configuration options and associated resources.
How to use the Azure Portal?
- Step 1 – Select the VM that we wish to redeploy, then select the Redeploy button in the Settings blade. We may need to scroll down to see the Support and Troubleshooting section that contains the ‘Redeploy’ button.
- Step 2 – To confirm the operation, select the Redeploy button
- Step 3 – The Status of the VM changes to Updating as the VM prepares to redeploy
- Step 4 – The Status then changes to Starting as the VM boots up on a new Azure host
- Step 5 – After the VM finishes the boot process, the Status then returns to Running, indicating the VM has been successfully redeployed