Share via

Az cli list result questions

Kevin Van heel 1 Reputation point
2022-04-29T14:11:20.56+00:00

The question to me seems quite simple. I am working from an organisation which doesn't allow to make use of functions that are still under development, hence my problem.

I am running everything through Azure Pipelines, so I can't store variables I get from the Az-Cli and then use powershell for example to perform operations on that variable.

The issue specifically lies in Lists (Yes, really, like one of the most common and well documented structures in all of computer programming).

I am trying to get the available IP-addresses my created V-NET has. Keep in mind, this being a big organisation I am not able to specify these myself as it's a fairly common task with boilerplate yml code to create the vnet.

Hence, I try running the az-cli command right after in the pipeline: "az network vnet list-available-ips -g MyResourceGroup -n MyVNet"
This correctly gives me the available ip-addresses that I am looking for.
HOWEVER storing once of these values seem to be impossible. I am not allowed to run --querry [0] after the command as this is a command currently under development.
I do not seem to be able to perform ANY action on the variable in which I stored this list. I am at lost here. How do I get access to 1 of the results in this list and then store this as separate variable? I need to be able to store this value in my library for further steps in my development pipeline

Community Center | Not monitored

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.