e2e: Connect to Azure Database for PostgreSQL with Entra ID managed credentials on the workbench-azure lane
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- azure, postgresql, typescript
Research direction
Read the existing managed credentials test at test/e2e/tests/workbench/managed-credentials/managed-credentials-azure.test.ts and the PostgreSQL connection test at test/e2e/tests/data-connections/postgres.test.ts. First establish the listed Azure server, tenant consent, lane sign-in scope, database role, secrets, and session packages. Add the tagged end-to-end coverage for the mechanism, connection identity, generated snippets, and rejection of non-Azure hosts; done when those checks pass on the workbench-azure lane.
Written by the indexing model from the issue text.
Description
Summary
#17572 adds an Entra ID (Workbench Managed Credentials) connection mechanism to the PostgreSQL driver. On Posit Workbench, the password is a delegated Entra ID access token that Workbench issues for the signed-in user. It goes only to an Azure Database for PostgreSQL host, and only with certificate verification.
Vitest covers the token client, error classification and the host check. An extension-host test covers the SSL options (sslVerify gives rejectUnauthorized: true). No test runs the mechanism end to end. These parts are untested:
- the connect path: a token from Workbench, the user name from the token, the connection to Azure
- the generated code
- certificate verification against a real Azure server
The workbench-azure lane already signs in to Workbench with Entra ID as the Positron service account (#17574). That makes an e2e test possible once the infrastructure below exists.
Test cases
Tag: @:workbench-azure (maybe also @:connections). Put the test next to test/e2e/tests/workbench/managed-credentials/managed-credentials-azure.test.ts, and reuse the dataConnections page object that test/e2e/tests/data-connections/postgres.test.ts uses.
-
The mechanism appears. In New Connection > PostgreSQL, the Entra ID (Workbench Managed Credentials) mechanism is listed.
-
Connect with an empty User. Enter the Azure host and database and leave User empty. Expected results:
- the connection succeeds
- the schema tree loads and a known table opens
- the connection runs as
[email protected]
-
Generated code. Open the code preview and check that the Python (psycopg2 and SQLAlchemy) and R snippets have:
- no literal token
sslmodeset toverify-full- a token fetched with posit-sdk (
get_delegated_azure_token) or rstudioapi (getDelegatedAzureToken)
Optional: run one snippet in the console and check that a query returns rows.
-
A non-Azure host is refused. With a host such as
db.example.com, Connect fails and shows the "only sent to Azure Database for PostgreSQL servers" message. No token is requested.
Infrastructure needed
- An Azure Database for PostgreSQL flexible server with Microsoft Entra ID authentication on. The lane's runners must be able to reach it (firewall or network rule).
- Admin consent in the tenant for the Workbench Entra ID app to request delegated tokens for the Azure Database for PostgreSQL resource (
https://ossrdbms-aad.database.windows.net). - The lane's Workbench requests the
offline_accessscope at sign-in. Delegated tokens need it. - A database role for
[email protected], for exampleSELECT * FROM pgaadauth_create_principal('[email protected]', false, false);, with read access to a small seeded database. - The server host name and database name in the lane's secrets (1Password), for example
E2E_AZURE_POSTGRES_HOST. - If generated code is run in test 3: posit-sdk 0.15.1 or later and rstudioapi 0.18.0 or later in the session image.
Dependencies
- #17588 (merged): Workbench lanes run the PR's Positron build, not the build that Workbench ships. Without it, this test would not exercise the change.
- #17574 (merged): sign-in to the
azurelane as the Positron service account.
Raised in review of #17572.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 207
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 308
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/positron
-
area: assistant area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
accessibility area: plots area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: plots area: ui bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: kernels lang: r
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
posit-dev/positron#17575 · 2 comments ·
Maintainers usually reply within 1 day
-
Memory meter counts page cache as used memory under a cgroup limitPossibly taken @jmcphers claimed this 10 days ago. Openarea: workbench bug memory-use support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17414 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in posit-dev/positron
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
novuhq/novu#13613 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#23943 ·
Maintainers usually reply within 1 day
-
comp/desktop desktop/chat P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NousResearch/hermes-agent#164451 ·
Maintainers usually reply within 1 day
-
shortkeys-2188:ready
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
crittermike/shortkeys#1121 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Doist/todoist-cli#742 ·