-1

i am new I am trying to use local pc power shell to execute commands like on azure portal power shell. enter image description here in my local power shell i can login to azure using az login. az commands are running but i am trying to execute pg_dump --help but it say cannot recognize this command. but az commands are working fine.

enter image description here on azure power shell cli i can execute all the pg_dumb commands without issue.

please answer.

Gamer X.
  • 1
  • 2

2 Answers2

1

I think you need to install Azure CLI in order to use the same commands on local powershell: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli

you need to have also pg_dump and pg_restore command-line utilities installed.

rafal.zak
  • 34
  • 3
  • still not working. pg_dump commands are not working. i am trying to make backup and restore using power shell – Gamer X. Sep 15 '22 at 12:41
  • 1
    Download command line from below link: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads – rafal.zak Sep 15 '22 at 12:46
  • i did but it works separately as sql shell but not working in power shell. i want to compile these commands in power shell – Gamer X. Sep 15 '22 at 13:06
  • Maybe you can create an alias to pg_dump.exe and then you will be able to use it in different location: PS C:\Program Files\PostgreSQL\14\bin> Set-Alias -Name pg_dump -Value "C:\Program Files\PostgreSQL\14\bin\pg_dump.exe" PS C:\Program Files\PostgreSQL\14\bin> cd .. PS C:\Program Files\PostgreSQL\14> pg_dump – rafal.zak Sep 16 '22 at 06:00
0

pg_dump is not part of the Azure CLI but is a PostgreSQL client application.

Cloud Shell happens to have a lot of packages installed already (i.E. terraform) and apparently pg_dump.

If you want to use it locally on your client you might want to look at installing the corresponding client tools. Maybe this SO thread helps (if you are running Windows): How do I install just the client tools for PostgreSQL on Windows?

holger
  • 788
  • 6
  • 8