-
Notifications
You must be signed in to change notification settings - Fork 2
Postgresql Resources
gcalexk edited this page Mar 18, 2022
·
5 revisions
Datahub only supports the managed instances of Postgresql deployed in Azure. To authenticate to the database, it is necessary to follow the Azure model which requires a token.
- Download and install pgAdmin
- Create a new server
- right-click on the Servers item in the Browser tab
- from the context menu, select Create -> Server
- In the Create Server dialog box, open the Connection tab and enter the Database Hostname and Database Username shown above in the Host name/address and Username textboxes, respectively
- Note: Do not enter any password at this time
- In the SSL tab, set the SSL mode to Require
- Save the server you have set up
- Obtain an access token using one of the following methods:
- Click the Generate Token button above.
- Click the copy button to copy the token to your clipboard.
- Enter
az login
. This will bring up a browser window to confirm the user name. You may be required to re-login. - Enter
az account get-access-token --resource-type oss-rdbms
. This will return a JSON object:{ "accessToken": "[a long character string]", "expiresOn": "[date and time]", "subscription": "...", "tenant": "...", "tokenType": "Bearer" }
- Select and copy the contents of the
accessToken
property.
- In pgAdmin, right-click on your previously created server and select Connect Server
- you may also double-click on the server to connect to it
- It should popup a dialog box asking for your password - paste the access token there
- Note: Do not check the "Save Password" checkbox, as your access token will expire after a certain time and you will need a fresh one to connect
- Click Ok to connect to the server