Set command (az --query sslCertificate.id) difficulty

%3CLINGO-SUB%20id%3D%22lingo-sub-2530765%22%20slang%3D%22en-US%22%3ESet%20command%20(az%20--query%20sslCertificate.id)%20difficulty%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2530765%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EHello%20friends%2C%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20need%20some%20help%20to%20tweak%20my%20result%20run%20via%20powershell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1%20-%20It%20works%2C%20but%20I%20want%20to%20list%20just%20the%20certificate%20name%20(Certified_Company_xXxXx)%3CBR%20%2F%3Eaz%20network%20application-gateway%20http-listener%20list%20-g%20XPTO%20--gateway-name%20XPTO%20--output%20table%20--query%20%22%5B%3Fcontains(protocol%2C'Https')%5D.%7BListiner%3Aname%2C%20URL%3AhostName%2C%20Certificate%3AsslCertificate.id%7D%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2%20-%20It%20works%2C%20but%20I%20want%20to%20list%20just%20the%20certificate%20name%20(Certified_Company_xXxXx)%3CBR%20%2F%3Eaz%20network%20application-gateway%20http-listener%20list%20-g%20XPTO%20--gateway-name%20XPTO%20--output%20table%20--query%20%22%5B%3Fprotocol%3D%3D'Https'%20%26amp%3B%26amp%3B%20sslCertificate.id%3D%3D'%2Fsubscriptions%2F00000000%2FresourceGroups%2FZZZZZ-EU%2Fproviders%2FMicrosoft.Network%2FapplicationGateways%2FXPTO%2FsslCertificates%2FCertified_Company_xXxXx'%5D.%7BListiner%3Aname%2C%20URL%3AhostName%2C%20Certificate%3AsslCertificate.id%7D%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3%20-%20It%20not%20works%3CBR%20%2F%3Eaz%20network%20application-gateway%20http-listener%20list%20-g%20XTPO%20--gateway-name%20XPTO%20--output%20table%20--query%20%22%5B%3Fcontains(sslCertificate.id%2C'xXxXx')%5D.%7BListiner%3Aname%2C%20URL%3AhostName%2C%20Certificate%3AsslCertificate.id%7D%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eaz%20%3A%20ERROR%3A%20Invalid%20jmespath%20query%20supplied%20for%20%60--query%60%3A%20In%20function%20contains()%2C%20invalid%20type%20for%20value%3A%20None%2C%20expected%20one%20of%3A%20%5B'array'%2C%20'string'%5D%2C%20received%3A%20%22null%22%3CBR%20%2F%3ENo%20linha%3A1%20caractere%3A1%3CBR%20%2F%3E%2B%20az%20network%20application-gateway%20http-listener%20list%20-g%20XPTO-%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(ERROR%3A%20Invalid%20...eceived%3A%20%22null%22%3AString)%20%5B%5D%2C%20RemoteException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20NativeCommandError%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20learn%20more%20about%20--query%2C%20please%20visit%3A%20'%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fquery-azure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fquery-azure-cli%3C%2FA%3E'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EThanks.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2530765%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Resource%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello friends,

 

i need some help to tweak my result run via powershell.

 

I want to show only the certificate name to make a smaller tab, but it just shows the entire id. The certificate name appears only at the end. This is also true of WAF policy.

 

And I also want to do a filter just by certificate name.

 

1 - It works, but I want to list just the certificate name (Certified_Company_xXxXx)

 

az network application-gateway http-listener list -g XPTO --gateway-name XPTO --output table --query "[?contains(protocol,'Https')].{Listiner:name, URL:hostName, Certificate:sslCertificate.id}"

 

2 - It works, but I want to list just the certificate name (Certified_Company_xXxXx)

 

az network application-gateway http-listener list -g XPTO --gateway-name XPTO --output table --query "[?protocol=='Https' && sslCertificate.id=='/subscriptions/00000000/resourceGroups/ZZZZZ-EU/providers/Microsoft.Network/applicationGateways/XPTO/sslCertificates/Certified_Company_xXxXx'].{Listiner:name, URL:hostName, Certificate:sslCertificate.id}"

 

3 - It not works


az network application-gateway http-listener list -g XTPO --gateway-name XPTO --output table --query "[?contains(sslCertificate.id,'xXxXx')].{Listiner:name, URL:hostName, Certificate:sslCertificate.id}"

 

az : ERROR: Invalid jmespath query supplied for `--query`: In function contains(), invalid type for value: None, expected one of: ['array', 'string'], received: "null"
No linha:1 caractere:1
+ az network application-gateway http-listener list -g XPTO- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ERROR: Invalid ...eceived: "null":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

To learn more about --query, please visit: 'https://docs.microsoft.com/cli/azure/query-azure-cli'

 

Thanks.

0 Replies