Forums

Connecting to Azure SQL Database from PA

I am trying to routinely access an Azure SQL database from the PA servers. I have successfully configured pyodbc with the FreeTDS driver, but now I am struggling with the issue of dynamic IP addresses on PA. I was using the Azure CLI to remotely whitelist the IP address of the current PA server with my Azure database, but this results in a number of other issues. Is there a more straightforward way to do this?

What are the "other issues"? If a service requires whitelisting of IPs, then you will need to whitelist the PA IPs, which can change.

Whitelisting IPs via the Azure CLI requires me to run Azure commands inside my python scripts inside a virtualenv which is causing issues. Getting errors saying the az command isn't found and stuff even though the Azure CLI package is installed. Also, using the Azure CLI first requires me to do a manual login where I follow a link and enter a code and I imagine that will cause issues in the future requiring me to reauthenticate or something. I figured there would be a simpler way to do it like generating a token that I could use to authenticate my script without having to whitelist the IPs every time.

Regarding the "command not found" issue, make sure you installed the Azure CLI in the venv that you indended and you're running it with having this venv activated.