![]() We say to Azure PowerShell CLI take the JSON content you get, and format it into a nice table for us. When we specify -o table e.g.: az group list -o table This az group list | select -p name should work, but does not, and I'd like to know how to do it properly, and in the process find out why it didn't work, and we can all learn something about Azure and powershell in the process, and life can be great! So all of this, to cut a long story short, is I'm wanting to know, how do you select just one property from the result of an azure query? In my case, I simply want to display the names of all my resource groups. Ok, I know it's supposed to be 10 strings, only because it's a computer and if that's what it is, then, that's what it really is. (az group list) and that returns bizarely 10 strings!. So to double check, I query for the first 10 elements of that array by doing. So the return types from az group list appear to be an array of objects or maybe it's an array of object, my powershell is scratchy here. However, (az group list).getType() returns PS src> (az group list).getType()Īnd lastly, hopefully the last 2 pieces of the puzzle PS src> (az group list).getType() "id": "/subscriptions/this-is-super-wierd-i-cant-select-name-prop/resourceGroups/spikes", scratch your head and wonder whats just happened? (grin)Īz group list on it's own returns a few screens full of this [.Observe a few screens full of blank lines. Observe that the list comes back and is formatted correctly. Here's the steps to reproduce the problem very easily, assuming you have an azure account. I'm hoping this will make sense to someone with more Azure and powershell experience. I tried the following experiments to dig into the exact types of objects being returned and get some results that I don't understand. ![]() ![]() So the question is, what's wrong with the command above? And how should I fix it? ![]() Then i get about 2 screens full of empty lines, with nothing displayed. However, if I try to select just the Name property by doing If I run the Azure command az group list -o table (after I have succesfully logged in using az login) I get the following typical response PS src> az group list -o table I know this sounds trivial, but here's where it gets strange, and I hope there is a simple explanation. I am trying to select just one property from an array of "result" (objects?) which come back from the Azure command az group list in powershell? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |