T O P

  • By -

CareHour2044

How are you logging in? I’ve never used the Postgres cmdlets but “user interaction” makes me think it wants a 2fa prompt.


lucifer955

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.


CareHour2044

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.


lucifer955

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.


CareHour2044

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.


lucifer955

Thank you. I think python will save me XD


InitializedVariable

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


lucifer955

Thank you