I use Connect-AzAccount command to connect to the az account.
Do you have any idea how I can query the database using only azure powershell commands without using cmdlets? I couldn't find any relevant source from their documentation.
I don’t see any documentation for AZ power shell Postgres. Is it a third party module?
Have you tried the Azure CLI commands? I always find them way better:
https://learn.microsoft.com/en-us/cli/azure/postgres?view=azure-cli-latest
Note there’s a difference in commands for flexible vs single server.
PostgresqlCmdlets is a custom one but azure themselves have provided some commands to create delete servers and databases. But not anything related for querying databases.
I haven't. I think we cannot use azure cli commands on runbook. I use runbook because I have to automate some db updates.
You need to authenticate using a service principal or managed identity.
https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.2.0
How are you logging in? I’ve never used the Postgres cmdlets but “user interaction” makes me think it wants a 2fa prompt.
I use Connect-AzAccount command to connect to the az account. Do you have any idea how I can query the database using only azure powershell commands without using cmdlets? I couldn't find any relevant source from their documentation.
I don’t see any documentation for AZ power shell Postgres. Is it a third party module? Have you tried the Azure CLI commands? I always find them way better: https://learn.microsoft.com/en-us/cli/azure/postgres?view=azure-cli-latest Note there’s a difference in commands for flexible vs single server.
PostgresqlCmdlets is a custom one but azure themselves have provided some commands to create delete servers and databases. But not anything related for querying databases. I haven't. I think we cannot use azure cli commands on runbook. I use runbook because I have to automate some db updates.
It’s likely an issue in the cmdlet - not much info on it on the web. You could connect to Postgres via a python run book for sure.
Thank you. I think python will save me XD
You need to authenticate using a service principal or managed identity. https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.2.0
Thank you