Hello @mandar Jogalekar ,
Thanks for reaching out.
Ideally, we receive the message The Vault '$KeyVaultName' not found within subscription
when the supplied name does not match a vault that is available in Azure, thus we would recommend that you use the --debug' parameter in combination with the above cmdlet which provides more insight from key aspects. Also, if feasible, could you supply the keyvault name directly in the cmdlet rather than using a variable? also also curious if the '$(KeyVaultName)' variable has any whitespace at the start or end of KeyVaultName.
az keyvault set-policy -n '{TypeKeyVaultName}' --secret-permissions get list --object-id '$(appId)' --debug
Here are some troubleshooting guidance on Azure CLI task within pipeline. If none of this works, then would recommend you to contact azure support as this requires a deeper investigation. Thank you for your cooperation on this matter
-----
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.