Forum Discussion
space3
Jan 17, 2021Copper Contributor
Azure subscription validation with Ansible
I would like to verify if an azure subscription exists using ansible. I tried using az account show -s {{sub}} but it fails with an error rather than returning that the "subscription doesn't exist message".
How to handle this gracefully?
Thanks,
RK
- space3Copper ContributorIt is solved with jq. Thanks!
az account list | jq '.[] | select(.name == "{{sub_name}}")|.name'