Add az site key commands to manage Site Keys for Azure Edge sites#9794
Add az site key commands to manage Site Keys for Azure Edge sites#9794aupmanyu-msft-work wants to merge 11 commits into
az site key commands to manage Site Keys for Azure Edge sites#9794Conversation
…identity - set_const signature is (name, value, type) not (name, type, value) - API requires identity.type=SystemAssigned on siteKey creation - Use hidden arg for siteResourceId populated in pre_operations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…key commands Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
…iteKey Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Create _error_handler.py with handle_sitekey_error() for known API errors - Integrate error handler into all 5 commands (create, show, delete, download, list) - Polished alerts follow Azure customer-facing style: clear title, numbered steps, error code - Handles: token expiry, duplicate key, site not found, key not found errors - Unknown errors pass through unchanged Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Format errors as 'Option N / Title / Recommendation' structure - Each option has labeled Title and indented numbered steps - Error code at the end - Supports multiple options per alert for future extensibility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add is_preview=True to 'site key' command group registration - Update HISTORY.rst to indicate [Preview] status and API version 2026-04-01-preview Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d3667e1 to
6462edf
Compare
…move docs - Move _error_handler.py out of aaz/latest/ tree to azext_site/ root (prevents clobbering on aaz-dev-tools regeneration) - Update all 5 command imports to reference new location - Fix _download.py docstring: .txt -> .SiteKey - Test now writes token to temp dir and cleans up after - Remove docs/ folder (contained only sitekey draft docs with drift) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add post-regen instructions comment to _error_handler.py - Wrap token file cleanup in try/finally so file is removed even on test failure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new preview az site key command group (create/show/list/delete/download) and bumps the extension version to 1.0.0b2, including scenario tests + recordings for the new functionality.
Changes:
- Bump extension version and update release notes for the new
site keycommand group. - Add generated AAZ command implementations for
az site key *plus CLI help entries. - Add a new scenario test and recordings covering
site keyCRUD + download.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/site/setup.py | Version bump to 1.0.0b2. |
| src/site/HISTORY.rst | Release notes for the new preview command group. |
| src/site/azext_site/_help.py | Adds help/usage text for site key commands. |
| src/site/azext_site/_error_handler.py | Adds custom error handling for common site key API failures. |
| src/site/azext_site/tests/latest/test_site.py | Adds scenario test for az site key CRUD + download. |
| src/site/azext_site/tests/latest/recordings/test_edge_site_key_crud.yaml | Adds recorded HTTP interactions for playback tests. |
| src/site/azext_site/aaz/latest/site/key/__cmd_group.py | Registers the site key command group (preview). |
| src/site/azext_site/aaz/latest/site/key/init.py | Exposes the new site key commands. |
| src/site/azext_site/aaz/latest/site/key/_create.py | Implements az site key create. |
| src/site/azext_site/aaz/latest/site/key/_delete.py | Implements az site key delete. |
| src/site/azext_site/aaz/latest/site/key/_list.py | Implements az site key list with paging. |
| src/site/azext_site/aaz/latest/site/key/_show.py | Implements az site key show. |
| src/site/azext_site/aaz/latest/site/key/_download.py | Implements az site key download and writes token to a local file. |
| token_file = os.path.join(tempfile.gettempdir(), "test-token.SiteKey") | ||
| try: | ||
| self.cmd( | ||
| "az site key download --name TestSiteKey --resource-group {{rg}} --file {f}".format(f=token_file), | ||
| checks=[ | ||
| self.exists("filePath"), | ||
| self.check("message", "Token saved successfully"), | ||
| ] | ||
| ) | ||
| finally: | ||
| if os.path.exists(token_file): | ||
| os.remove(token_file) |
| self.exists("filePath"), | ||
| self.check("message", "Token saved successfully"), | ||
| ] | ||
| ) |
| file_path = os.path.abspath(file_path) | ||
| with open(file_path, "w") as f: | ||
| f.write(token) | ||
| logger.warning("Token saved to %s", file_path) | ||
| return {"filePath": file_path, "message": "Token saved successfully"} |
| file_path = os.path.abspath(file_path) | ||
| with open(file_path, "w") as f: | ||
| f.write(token) |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add CLI commands to manage Site Keys (siteKeys) for Azure Edge sites, scoped to resource group.
API version:
2026-04-01-preview(Microsoft.Edge/siteKeys)Related command
az site key create- Create a site key linked to a siteaz site key show- Get details of a specific site keyaz site key list- List all site keys in a resource groupaz site key delete- Delete a site keyaz site key download- Download the token for a site key to a fileGeneral Guidelines
azdev stylelocally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions: