Monday, May 21, 2018

AzureRM Powershell script to list down all the resource group

function listresourcegroup
{
Wtite-host " Fetching resource group details, please wait for few seconds...."
echo ""
$rsgrp=Get-AzureRmResourceGroup | select ResourceGroupName
$rscount=$rsgrp.count
write-host "Available Resource groups" -BackgroundColor yellow -ForegroundColor blue
write-host "========================"
    foreach($item  in $rsgrp)
    {

        write-host "       Resource Group Name  --  " $item.ResourceGroupName -BackgroundColor yellow -ForegroundColor black


    }

echo ""

Write-host "No of Resource group : " $rscount -BackgroundColor yellow -ForegroundColor red


$RsGrp_choice = read-host "Enter resource group Name to see details, Press '1' to return to main menu:"


    if($RsGrp_choice -eq 1)
    {

        menu

    }
    else
    {

        get-AzureRmResourceGroup -name $RsGrp_choice

        $rsch= read-host "Want to continue [y/n]"
        if($rsch -eq "y")
        { RSgrp_item }
        elseif($rsch -eq "n")
        { RsGrp }
        else { main }

    }

}


No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...