This is Continuity to or requirement, from my previous question.
Instead of running the command for usernames once and passwords once, can't we run the below command to store both username and password in same array variable and fetch.
$userNames=az webapp deployment list-publishing-profiles --name newjan --resource-group xxxx --query '[].userName' -o tsv
$userNames
$Passwords=az webapp deployment list-publishing-profiles --name newjan --resource-group xxxx --query '[].userPWD' -o tsv
$Passwords
This code snippets given by the user Jahnavi
Requirement:
I need the same command to store both usernames and passwords in the same variable array but I'm getting below errors when I tried:
$userCreds=az webapp deployment list-publishing-profiles --name newjan --resource-group xxxx --query '[].userName, [].userPWD' -o tsv
ERROR: argument --query: invalid jmespath_type value: '[].userName, [].userPWD'
To learn more about --query, please visit: 'https://docs.microsoft.com/cli/azure/query-azure-cli'
$userCreds=az webapp deployment list-publishing-profiles --name newjan --resource-group xxxx --query '[].userName', '[].userPWD' -o tsv
ERROR: argument --query: invalid jmespath_type value: "'[].userName',"
To learn more about --query, please visit: 'https://docs.microsoft.com/cli/azure/query-azure-cli'
In addition to the SO worked by me, it can be done in a single attempt with the command az webapp deployment list-publishing-profiles
as shown below.
$Profile=az webapp deployment list-publishing-profiles --name <webapp> --resource-group xxxx --query '[].{UserName: userName, Password: userPWD}' -o tsv
$Profile
Output: