Chirag Nagrekar has Published 465 Articles

How to get the load balancers connected to the Azure VM using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:52:41

To get the load balancers attached to the Azure VM using PowerShell, we first need to retrieve the Azure VM network settings. For example, we have an Azure VM name “TestVM” and we willPS C:\> $vm = Get-AzVM -Name TestVM $nic = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1]Once we have the network interface name, we ... Read More

How to get the Azure VM virtual Network and the Subnet name using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:51:41

To retrieve the Azure VM virtual network and subnet name, we first need to retrieve the AzureVM NIC information. To get the Azure VM NIC information, we need to use the Get-AzVM command, and then we can use the NetworkProfile property to retrieve the NIC name as shown below.PS C:\> ... Read More

How to retrieve the Azure VM nic name using Azure CLI in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:49:50

To get the Azure VM NIC name using Azure CLI, use the below command but before running the command make sure that you are connected to the Azure Account and the proper Azure subscription using Azure CLI.az vm show -n AzureVM -g ResourceGroup --query '[networkProfile.networkInterfaces][].id' -otsvWe need the NIC name ... Read More

How to get the currently logged-in user account with Azure CLI in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:35:09

To get the connected user account with the Azure CLI, you need to use the below command.PS C:\> az account showOnce you type the command, you will get the output in JSON format as shown below.PS C:\> az account show {    "environmentName": "AzureCloud",    "homeTenantId": "Your tenant ID",   ... Read More

How to Install the Azure CLI on Windows using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:32:31

To install the Azure CLI, you can download it from the location below, https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli/To install the Azure CLI using PowerShell, use the below command.Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows - OutFile .\AzureCLI.msi Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet' rm .\AzureCLI.msiTo check if the Az CLI is installed successfully run the Az in ... Read More

How to get the Azure VM available sizes using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:31:05

To get the Azure VM sizes using PowerShell, we can use the Get-AzVmSize command.To get all the supported Azure VM sizes as per location, use the below command.PS C:\> Get-AzVMSize -Location EastusOutputTo get available and supported size for the existing virtual machine, use the below command.Get-AzVMSize -ResourceGroupName ResourceGroup1 -VMName TestVMRead More

How out-gridview selection works in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:28:50

With the PowerShell Out-Gridview output, you have an option to select one or multiple selections.For example, if we run the below command, it will show us the output in the grid format.PS C:\> Get-Process | Out-GridViewIn this output, you don’t get any option to select the rows because its output ... Read More

How to get the installed Azure VM extension using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:19:01

To get the installed Azure VM extension using PowerShell, we can use the Get-AzVmExtension command and we need to provide VM name and the resource group name in the command.$vm = Get-AzVM -Name TestVM Get-AzVMExtension -VMName $vm.Name -ResourceGroupName $vm.ResourceGroupNameThe above command will retrieve all the extensions in detail of the ... Read More

How to enable soft delete for Azure Storage blobs using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 09:01:11

To enable soft delete for Azure Storage blobs in Storage account properties using PowerShell, we can use the Enable-AzureStorageDeleteRetentionPolicy command. From the Azure portal, we need to access the Data Protection property of the Azure Storage account.You can also provide the retention days to keep the soft-deleted data. To perform the ... Read More

How to create the Azure Storage context using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 01-Sep-2021 08:56:04

Storage context is helpful when you are working with the Storage accounts in the PowerShell session. It is like authenticating for Azure storage. Generally, we use the Azure storage account key and the connection string to create the Azure storage context.To create a new storage context, we need to use ... Read More

Advertisements