Azure / Azure/azure-cli-extensions

[acrcssc] Awareness: az acr supply-chain workflow create --run-immediately fails in Azure Cloud Shell: ORAS receives 403 without WWW-Authenticate during OCI artifact push to csscpolicies

Open
#10,003 2 comments 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

Source: https://github.com/Azure/azure-cli/issues/32817 (by @sitzmana)
Affected extension: `acrcssc` (`src/acrcssc/`)

---

<<>>
# Issue #32817 (by @sitzmana)
## Title
Awareness: az acr supply-chain workflow create --run-immediately fails in Azure Cloud Shell: ORAS receives 403 without WWW-Authenticate during OCI artifact push to csscpolicies

## Body
### Describe the bug

When running az acr supply-chain workflow create with --run-immediately true from Azure Cloud Shell (PowerShell on Linux), the command fails during the OCI artifact publication step. The acrcssc extension invokes ORAS to push an OCI artifact to csscpolicies/patchpolicy:v1, but the registry responds with HTTP 403 and does not include a WWW-Authenticate header. ORAS cannot negotiate authentication and retries until failure. The same command succeeds from non-Cloud Shell environments (local workstation / Azure VM) against the same registry.

This appears to be Cloud Shell-specific behavior (credential handoff / auth challenge handling) rather than a general ACR service issue, since the same operation works from other environments.

Full execution fails during OCI artifact push:

Extension logs: “Publish OCI artifact to: csscpolicies/patchpolicy:v1”
ORAS attempts blob upload initiation:
POST /v2/csscpolicies/patchpolicy/blobs/uploads/
Response is 403 and missing WWW-Authenticate challenge header
ORAS logs:
“Www-Authenticate not found in original response, cannot authenticate.”
Retries with backoff; command appears to stall until retries stop or user interrupts.

See below for failed vs success. On cloud shell the ACR returns 403. On local machine the ACR returns 401

### Related command

az acr supply-chain workflow create -r -g --type continuouspatchv1 --schedule 1d --config ./continuouspatching.json --dry-run false --run-immediately true --debug

The command succeeds when run with --dry-run true and --run-immediately false

### Errors

cli.azext_acrcssc.helper._ociartifactoperations: Login to ACR completed successfully.
cli.azext_acrcssc.helper._ociartifactoperations: Publish OCI artifact to: csscpolicies/patchpolicy:v1
oras.logger: Preparing layer {'mediaType': 'application/vnd.oci.image.layer.v1.tar', 'size': , 'digest': '', 'annotations': {'org.opencontainers.image.title': ''}}
urllib3.connectionpool: Starting new HTTPS connection (1): .azurecr.io:443
urllib3.connectionpool: https://.azurecr.io:443 "POST /v2/csscpolicies/patchpolicy/blobs/uploads/ HTTP/1.1" 403
oras.logger: Www-Authenticate not found in original response, cannot authenticate.
oras.logger: Retrying in 3 seconds - error: Cannot respond to request for authentication.

### Issue script & Debug output

cli.azext_acrcssc.helper._ociartifactoperations: Login to ACR completed successfully.
cli.azext_acrcssc.helper._ociartifactoperations: Publish OCI artifact to: csscpolicies/patchpolicy:v1
oras.logger: Preparing layer {'mediaType': 'application/vnd.oci.image.layer.v1.tar', 'size': , 'digest': '', 'annotations': {'org.opencontainers.image.title': ''}}
urllib3.connectionpool: Starting new HTTPS connection (1): .azurecr.io:443
urllib3.connectionpool: https://.azurecr.io:443 "POST /v2/csscpolicies/patchpolicy/blobs/uploads/ HTTP/1.1" 403
oras.logger: Www-Authenticate not found in original response, cannot authenticate.
oras.logger: Retrying in 3 seconds - error: Cannot respond to request for authentication.

### Expected behavior

cli.azext_acrcssc.helper._ociartifactoperations: Publish OCI artifact to: csscpolicies/patchpolicy:v1
oras.logger: Preparing layer {'mediaType': 'application/vnd.oci.image.layer.v1.tar', 'size': 190, 'digest': 'sha256:8041ddc00c9824bb6449f8204a03eb771acaa931e2d152a8c3add12249684664', 'annotations': {'org.opencontainers.image.title': ''}}
urllib3.connectionpool: Starting new HTTPS connection (1): .azurecr.io:443
urllib3.connectionpool: https://.azurecr.io:443 "POST /v2/csscpolicies/patchpolicy/blobs/uploads/ HTTP/1.1" 401 290
oras.logger: Service: .azurecr.io
oras.logger: Scope: repository:csscpolicies/patchpolicy:pull,push
oras.logger: Requesting auth token for: authHeader(lookup={'service': '.azurecr.io', 'realm': 'https://.azurecr.io/oauth2/token', 'scope': 'repository:csscpolicies/patchpolicy:pull,push'})
urllib3.connectionpool: https://.azurecr.io:443 "GET /oauth2/token?service=.azurecr.io&scope=repository%3Acsscpolicies%2Fpatchpolicy%3Apull%2Cpush HTTP/1.1" 200 None
urllib3.connectionpool: https://.azurecr.io:443 "POST /v2/csscpolicies/patchpolicy/blobs/uploads/ HTTP/1.1" 202 0
urllib3.connectionpool: https://.azurecr.io:443 "PUT /v2/csscpolicies/patchpolicy/blobs/uploads/?_nouploadcache=false&_state=&digest=sha256%3A8041ddc00c9824bb6449f8204a03eb771acaa931e2d152a8c3add12249684664 HTTP/1.1" 201 0
oras.logger: Preparing config {'mediaType': 'application/vnd.unknown.config.v1+json', 'size': 2, 'digest': 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a'}
urllib3.connectionpool: https://.azurecr.io:443 "POST /v2/csscpolicies/patchpolicy/blobs/uploads/ HTTP/1.1" 202 0
urllib3.connectionpool: https://.azurecr.io:443 "PUT /v2/csscpolicies/patchpolicy/blobs/uploads/?_nouploadcache=false&_state=&digest=sha256%3A44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a HTTP/1.1" 201 0
urllib3.connectionpool: https://.azurecr.io:443 "PUT /v2/csscpolicies/patchpolicy/manifests/v1 HTTP/1.1" 201 0
Successfully pushed .azurecr.io/csscpolicies/patchpolicy:v1

### Environment Summary

### **Failed:**
Execution environment:
- Azure Cloud Shell
- Shell type: PowerShell (Linux)

Operating system:
- Linux
- Kernel: 6.1.124.1-microsoft-standard
- libc: glibc 2.38
- Architecture: x86_64

Azure CLI:
- Azure CLI version: 2.82.0
- Distribution: RPM-based
- Python version: 3.12.9
- Azure SDK Core: azsdk-python-core/1.37.0

Credential model:
- CloudShellCredential (brokered identity)

User agent:
- AZURECLI/2.82.0 (RPM)
- azsdk-python-core/1.37.0
- Python/3.12.9
- Linux
- cloud-shell/1.0

Command context:
- acr supply-chain workflow create
- Uses acrcssc extension (preview)

### **Success:**
Execution environment:
- Local terminal (non–Cloud Shell)
- Shell type: PowerShell

Operating system:
- Windows 11
- OS version: 10.0.28020
- Architecture: x64

Azure CLI:
- Azure CLI version: 2.77.0
- Distribution: MSI
- Python version: 3.13.7
- Azure SDK Core: azsdk-python-core/1.35.0

Credential model:
- UserCredential (MSAL broker enabled)

User agent:
- AZURECLI/2.77.0 (MSI)
- azsdk-python-core/1.35.0
- Python/3.13.7
- Windows-11

Command context:
- acr supply-chain workflow create
- Uses acrcssc extension (preview)

### Additional context

_No response_

## Comments
### Comment by @yonzhan

Thank you for opening this issue, we will look into it.

### Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @northtyphoon, @luisdlp, @terencet-dev, @shizhMSFT, @JXavierMSFT.

<<>>

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.