Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Azure PowerShell :: how to print a list of properties

I found on this post how to print the the Azure Subscription ID:

(Get-AzContext).Subscription.id

But if I look in the official documentation of the command Get-AzContext I don’t see anywhere that the .Subscription.id or .id would print that information.

How the guy who replied to that question knew such information?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Where can I find a list of properties for each command?

Commmands like Get-AzContext | fl * or Get-AzContext | gm or get-help Get-AzContext -full don’t provide such list.

I want to be able to see all properties provided by commands like Get-AzResource or Get-AzSqlDatabase or any other.

>Solution :

Problably not the cleanest way, but as I use this trick very often and since I shared to some teammates I noticed they are using it now I guess it worths sharing 🙂 .

Use the convertto-json -depth xx (where xx is big enough for your need and depending on the objet’s complexity) to get the whole view of an object
Then you can redirect to a file and look for what you need quite easily.

In case you run Get-AzContext | convertto-json -depth 10 you will find back the subscription and the ID.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading