Fix job attachment 401s for submitted jobs - #773
Conversation
- upload_attachment, download_attachment, and list_attachments in base_job.py were reusing the unsigned container_uri returned by job creation instead of always fetching a fresh SAS-signed URI via workspace.get_container_uri(), causing 401 NoAuthenticationInformation errors. - build_services_jobs_update_request in the generated _operations.py used the wrong URL path segment 'jobUpdateOptions' (the request model type name) instead of 'jobs', causing workspace.update_job() to fail with 404 Not Found.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
Attachment methods now target the wrong container for jobs created with a custom container name.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes attachment authentication failures and the incorrect job-update endpoint.
Changes:
- Refreshes SAS-signed attachment container URIs.
- Corrects job PATCH requests to use
/jobs/{jobId}. - Adds regression tests for both fixes.
File summaries
| File | Description |
|---|---|
base_job.py |
Refreshes attachment container SAS URIs. |
_operations.py |
Corrects the job update route. |
test_job_attachments.py |
Tests attachment URI handling. |
test_workspace.py |
Tests the PATCH resource path. |
Review details
Suppressed comments (2)
azure-quantum/azure/quantum/job/base_job.py:381
- This selects the default
job-{id}container rather than the container encoded inself._details.container_uri. Jobs created with a customcontainer_namewill therefore download from the wrong location. Request the fresh SAS usingself.container_nameand update the test expectation accordingly.
container_uri = self.workspace.get_container_uri(job_id=self.id)
azure-quantum/azure/quantum/job/base_job.py:400
- Listing now ignores the job's actual linked container name and always targets
job-{id}. This breakslist_attachments()for the supported custom-container flow infrom_input_data; obtain the fresh SAS forself.container_nameand cover that case in the attachment tests.
container_uri = self.workspace.get_container_uri(job_id=self.id)
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
Caller-supplied containers from different storage accounts can be redirected to same-named workspace containers.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
azure-quantum/azure/quantum/job/base_job.py:387
- For jobs created with
from_storage_uri(..., container_uri=...)against another storage account, this re-signs only the extracted container name in the workspace's configured account. The download then reads a different container rather than the job's explicitly linked one. Preserve a usable explicit job-level URI, or restrict workspace SAS refresh to URIs known to be in workspace storage.
container_uri = self.workspace.get_container_uri(
job_id=self.id,
container_name=self.container_name,
)
azure-quantum/azure/quantum/job/base_job.py:409
- This loses the storage-account identity from a caller-supplied job
container_uri:get_container_uriselects the workspace-linked/configured account using only the name. Consequently,list_attachments()can list an unrelated same-named container (or create and list an empty one) instead of the explicit container retained byfrom_storage_uri. Preserve a usable explicit URI or verify the account before refreshing its SAS through the workspace.
container_uri = self.workspace.get_container_uri(
job_id=self.id,
container_name=self.container_name,
)
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Cached and refreshed URIs lack required identity, security, start-time, signature, and permission validation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Cached and refreshed URIs lack the promised identity, permission, start-time, signature, and HTTPS validation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Resolved since last review (1)
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |


Summary
Fixes job attachment operations failing after submission because the service stores an unsigned container URI.
upload_attachment,download_attachment, andlist_attachmentsnow:r,w, andl), start time, and expiry.Custom container names remain supported. The legacy
Workspace(storage=...)connection-string path is intentionally outside this PR's scope; its deprecation will be tracked separately.Testing
25 passed.127 passed, 18 skipped.34 passed, 2 skippedin the DPv2 SDK job). The broader live build had unrelated CLI and third-party failures. The attachment E2E will be rerun against the final revision.Related
The generated job-update endpoint correction is intentionally left to #772, which regenerated the complete client with the corrected
/jobs/{jobId}route.