Found 975 Articles for Software & Coding

How to get the Azure resource group using Azure CLI in PowerShell?

Chirag Nagrekar
Updated on 31-Aug-2021 09:45:49

8K+ Views

To get all the Azure resource groups connected to the particular subscription use the az group command.Before using this command make sure you are connected with the Azure account and if not connect the azure account with the “Az login”Once you are connected to the Azure account, set the subscription name for which you want to retrieve the resource groups.az account set --subscription 'subscription name or id'Once you have set the subscription, use the below command to retrieve all the resource groups.PS C:\> az group list -otableTo get the particular resource group details, use the below command.PS C:\> az group ... Read More

How to connect to the Azure subscription using Azure CLI in PowerShell?

Chirag Nagrekar
Updated on 31-Aug-2021 09:45:03

9K+ Views

To connect to the specific azure subscription using Az CLI we need to use “Az account set” command but before using this command make sure you are connected with the Azure cloud using “az login” account.az account set --subscription 'subscription name or id'You can also use -s instead of --subscription.az account set -s 'subscription name or id'To check if the subscription is set properly, use the below command.PS C:\> az account show -otable

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

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

12K+ Views

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",    "id": "Subscriptio ID",    "isDefault": true,    "managedByTenants": [],    "name": "Subscription Name",    "state": "Enabled",    "tenantId": "tenant ID",    "user": {     "name": "user logged in email id or username",     "type": "user"    } }To get the output in the table format, use the -otable or –output tablePS C:\> az account show -otable

How to Install the Azure CLI on Windows using PowerShell?

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

7K+ Views

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 the cmd or the PowerShell.

How to get the Azure VM available sizes using PowerShell?

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

808 Views

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 TestVM

How to get the Application security groups of the Azure VM using PowerShell?

Chirag Nagrekar
Updated on 31-Aug-2021 09:40:48

572 Views

To get the Application security groups of the Azure VM using PowerShell, we need to first get the Network Interface of the Azure VM.The below command will retrieve the NIC name of the Azure VM.PS C:\> $vm = Get-AzVM -Name TestVM $nic = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1]Once we have the NIC name, we can use the Get-AzNetworkInterface command to retrieve the NIC information and the Security group.The below command will retrieve the application security group names using PowerShell.PS C:\> $nicsettings = Get-AzNetworkInterface -Name $nic $nicsettings.IpConfigurations.ApplicationSecurityGroups

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

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

536 Views

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 need to retrieve the load balancer settings, and to get the Load Balancer settings we need to use the Get-AzNetworkInterface command.PS C:\> $nicsettings = Get-AzNetworkInterface -Name $nicThe below command will retrieve the load balancer name.(($nicsettings.IpConfigurations.LoadBalancerBackendAddressPools.id).Split('/'))[-3]To get the Load Balancer backend pool name, use the below command.(($nicsettings.IpConfigurations.LoadBalancerBackendAddressPools.id).Split('/'))[-1]Overall Script −$vm = Get-AzVM ... Read More

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

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

2K+ Views

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:\> $vm = Get-AzVM -Name TestVM $vmnic = ($vm.NetworkProfile.NetworkInterfaces.id).Split('/')[-1]Once we have the NIC name stored from the above command in the $vmnic variable, we can retrieve the NIC information using the Get-AzNetworkInterface command as shown below.$vmnicinfo = Get-AzNetworkInterface -Name $vmnicTo get the Virtual Network name attached to the VM use the ... Read More

How to retrieve the Azure subnets connected to the virtual network using PowerShell?

Chirag Nagrekar
Updated on 31-Aug-2021 09:38:11

2K+ Views

To get all the subnets attached to the virtual network using PowerShell, we need to use the GetAzVirtualNetwork command.PS C:\> $vn = Get-AzVirtualNetwork -Name VirtualNetworkNameTo get the Subnets and its address prefix details, you need to filter out the Subnets and AddressPrefixPS C:\> $vn.Subnets | Select Name, AddressPrefix

How out-gridview selection works in PowerShell?

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

1K+ Views

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 mode is none. To add the single selection from the output, use the Output mode to single, and for the multiple selections use the output mode to multiple. Once you add the OutpuMode property you can see the OK and Cancel button at the bottom right of the grid.Single output ... Read More

Advertisements