Versions: Databricks CLI v1.16.0 (Windows, winget) · Azure Databricks workspace · profile auth_type = databricks-cli (U2M, token in the OS keyring)
Repro
databricks apps logs <app-name> --tail-lines 20
Actual: --debug shows the CLI resolving the app and dialing wss://<app>.azure.databricksapps.com/logz/stream, then:
Error: websocket: bad handshake (HTTP 302 Found)
The 302 is the app domain redirecting to /oidc/oauth2/v2.0/authorize, so the credential on the request wasn't accepted.
Expected: the log stream.
Evidence that the app and permissions are fine (same user, same moment):
| Request |
Result |
GET https://<app>/logz with Authorization: Bearer $(databricks auth token) |
200 |
GET https://<app>/logz without a token |
302 to authorize |
websocket upgrade wss://<app>/logz/stream with that bearer + Origin: https://<app> |
101; after sending one empty text message, JSON log records stream normally |
Forcing the CLI onto the same token as a PAT (DATABRICKS_AUTH_TYPE=pat, DATABRICKS_TOKEN=...) fails differently: Error: OAuth Token not supported for current auth type pat.
So the app domain accepts the workspace token from databricks auth token, but it rejects whatever credential apps logs attaches to its websocket dial.
Workaround: connect to /logz/stream directly with the bearer from databricks auth token, an Origin header, and an initial empty message.
Versions: Databricks CLI v1.16.0 (Windows, winget) · Azure Databricks workspace · profile
auth_type = databricks-cli(U2M, token in the OS keyring)Repro
Actual:
--debugshows the CLI resolving the app and dialingwss://<app>.azure.databricksapps.com/logz/stream, then:The 302 is the app domain redirecting to
/oidc/oauth2/v2.0/authorize, so the credential on the request wasn't accepted.Expected: the log stream.
Evidence that the app and permissions are fine (same user, same moment):
GET https://<app>/logzwithAuthorization: Bearer $(databricks auth token)GET https://<app>/logzwithout a tokenwss://<app>/logz/streamwith that bearer +Origin: https://<app>Forcing the CLI onto the same token as a PAT (
DATABRICKS_AUTH_TYPE=pat,DATABRICKS_TOKEN=...) fails differently:Error: OAuth Token not supported for current auth type pat.So the app domain accepts the workspace token from
databricks auth token, but it rejects whatever credentialapps logsattaches to its websocket dial.Workaround: connect to
/logz/streamdirectly with the bearer fromdatabricks auth token, anOriginheader, and an initial empty message.