Skip to content

[Containerapp] az containerapp up: Validate registry server - #34262

Open
Vini Soto (vinisoto) wants to merge 2 commits into
Azure:devfrom
vinisoto:vsoto-microsoft-registry-server-validation
Open

Vini Soto (vinisoto) wants to merge 2 commits into
Azure:devfrom
vinisoto:vsoto-microsoft-registry-server-validation

Conversation

@vinisoto

@vinisoto Vini Soto (vinisoto) commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command

az containerapp up --repo

Description

Validate the registry server before automatically retrieving ACR credentials when the registry username or password is missing.

The check uses the active cloud's ACR login-server suffix, normalizes the server name to lowercase, and rejects names containing additional dots before the suffix. Invalid servers raise ValidationError with guidance to provide a registry server or explicit credentials.

The change is limited to the credentials-missing branch in _get_registry_details. Existing handling of explicitly supplied credentials and the existing --source guard are unchanged.

Testing Guide

Added mocked unit tests covering:

  • Valid ACR servers, mixed-case names, and a sovereign-cloud suffix.
  • Invalid registry servers, with no credential lookup.
  • Missing and partially supplied credentials.
  • Explicit credentials for Docker Hub, GHCR, and ACR.
  • Behavior with and without --source.

Validation results:

  • azdev style containerapp — passed.
  • azdev linter containerapp — passed.
  • azdev test test_containerapp_up_utils test_containerapp_utils test_containerapp_validators --series --pytest-args --disable-socket — passed: 6 tests and 45 subtests.
  • azdev test containerapp --series --pytest-args --disable-socket "--allow-hosts=localhost,$env:COMPUTERNAME" — stopped after 34 passed and 8 skipped; test_containerapp_compose_create_with_environment failed with KeyError: 'foo' in compose handling, outside the changed function.

History Notes

[Containerapp] az containerapp up: Validate registry server before getting ACR credentials


This checklist is used to make sure that common guidelines for a pull request are followed.

…getting ACR credentials

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 424ccbab-d4be-43b7-a649-157ea7cf3da6
Copilot AI balanced review requested due to automatic review settings October 22, 2026 18:30
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@vinisoto Vini Soto (vinisoto) changed the title [Containerapp] az containerapp up: Validate registry server before getting ACR credentials [Containerapp] az containerapp up: Validate registry server Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

URL-prefixed ACR servers produce an incorrect registry name, breaking previously handled credential lookups.

1 open issue
What changed in this PR

This PR adds registry validation before az containerapp up automatically retrieves Azure Container Registry credentials.

Changes:

  • Validates registry names against the active cloud’s ACR suffix when either credential is missing.
  • Adds mocked tests for valid and invalid servers, partial credentials, and existing source behavior.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​containerapp/​tests/​latest/​test_containerapp_up_utils.py Adds focused registry validation and credential-lookup tests.
src/​azure-cli/​azure/​cli/​command_modules/​containerapp/​_up_utils.py Validates and normalizes registry names before automatic credential lookup.

Review effort: Balanced

Comment thread src/azure-cli/azure/cli/command_modules/containerapp/_up_utils.py Outdated
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Vini Soto (@vinisoto),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 424ccbab-d4be-43b7-a649-157ea7cf3da6
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants