Here’s a small but very helpful feature that I’m pretty sure the vast majority of cloud administrators often overlook. Occasionally, to generate the output required and then export to a CSV file, we go straight to PowerShell. Those files are consumed later with a series of scripts that we create to organize, automate, and optimize our Azure environments. One thing that we have in the Azure Portal that is extremely helpful and sometimes does not require an administrator to power up a PowerShell session is the Edit Columns (Item 1) and Export to CSV (Item 2) option that is commonly found in most of the blades in Azure Portal.
Let’s start with Edit Columns, a new blade will be displayed, and we can pick and choose which information we want to be displayed in the previous blade. An important note, if you messed up the columns and didn’t remember how they used to be, no worries, just hit the reset button and you will be going back to the original settings and can start again with your customization.
After customizing the columns that are being displayed, we can see the new values, as depicted in the image below.
Now that we have all columns that are showing the information that we were looking for, we can hit the Export to CSV button, and a new CSV file will be available for download. If we open that file with Excel, we will see the same information of the portal in a CSV file.
Now that we have a CSV, we can go to PowerShell and consume the file. In the cmdlets below we are reading the entire CSV and placing in a $rg variable and displaying the content afterward.
Get-Item *csv $rg = Import-CSV ./AzureresourceGroups.csv $rg
Using these two small features of the Azure Portal the administrator can see the data on the fly, before creating the CSV file that can be used later on to generate reports or as input in your future PowerShell scripts.
Featured image: Shutterstock