Skip to content

Commit a4f54f8

Browse files
sakshamgargMSSaksham Garg
andauthored
Update managed cleanroom cmdlets (#9700)
* update cmdlets as per frontend spec changes + test fixes+ help * update ManagedCleanroom frontend cmdlets * Fix version: change from 1.0.0b4 to 1.0.0b3 - Updated VERSION in setup.py to 1.0.0b3 - Merged 1.0.0b4 changelog into 1.0.0b3 in HISTORY.rst - All features remain the same (API versioning support) - Added helper files to .gitignore Validation passed: - 37/37 pytest tests passed - azdev style: PASSED - azdev linter: PASSED - test_index.py: 9 tests passed (2 skipped) - aaz folder: unchanged * Update to latest Frontend API spec from develop branch - Pulled latest spec from azure-cleanroom develop branch - Fixed ApplicationState empty enum value (AutoRest blocker) - Regenerated analytics_frontend_api SDK with updated method signatures - Applied Microsoft MIT License headers to all SDK files - Updated custom code for SDK method renames (5 functions) - Updated test mocks for new SDK methods (14 changes across 3 files) - Added comprehensive pylint suppressions for generated code SDK Method Changes (internal, transparent to CLI): - list → list_get - analytics_dataset_* → analytics_datasets_* (plural) - check_consent_document_id_get → consent_document_id_get - set_consent_document_id_put → consent_document_id_put Validation (all passed): - pytest: 37/37 tests passed - azdev style: PASSED - azdev linter: PASSED - test_index: PASSED - aaz folder: unchanged - wheel: built successfully (157K) Version: 1.0.0b3 (kept same as requested) * parameterize cmdlets * linter and styling fixes * update query segments to be json objects * Remove extension-specific entries from global .gitignore - Removed .opencode/ and personal helper scripts from global .gitignore - These are extension-specific development files that should not be in the global ignore list - Files will remain untracked locally without affecting the repository Addresses PR review feedback * Update .gitignore * update extension version --------- Co-authored-by: Saksham Garg <sakshamgarg@microsoft.com>
1 parent 442e523 commit a4f54f8

27 files changed

+4565
-3947
lines changed

src/managedcleanroom/HISTORY.rst

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,46 @@ Release History
44
===============
55

66
1.0.0b1
7-
++++++
7+
+++++++
88
* Initial release.
99

1010
1.0.0b2
11-
++++++
11+
+++++++
1212
* Add frontend commandlets
1313
* Add MSAL device code flow authentication
1414

1515
1.0.0b3
1616
++++++
17-
* Update commands to reflect new API version 2026-03-31-preview
17+
* Update commands to reflect new API version 2026-03-31-preview
18+
19+
1.0.0b4
20+
+++++++
21+
* Updated to latest Frontend API spec from develop branch (2026-03-01-preview)
22+
* Regenerated analytics_frontend_api SDK with updated method signatures
23+
* SDK Changes (internal, transparent to CLI users):
24+
- Method renames: collaboration.list → collaboration.list_get
25+
- Method renames: analytics_dataset_* → analytics_datasets_* (dataset → datasets, plural)
26+
- Method renames: check_consent_document_id_get → consent_document_id_get
27+
- Method renames: set_consent_document_id_put → consent_document_id_put
28+
* BREAKING CHANGE: All frontend API endpoints now require api-version=2026-03-01-preview query parameter
29+
* Added: --api-version parameter to all frontend commands (default: 2026-03-01-preview)
30+
* Updated: SDK client now automatically injects api-version into all API requests
31+
* BREAKING CHANGE: Removed deprecated commands (APIs no longer supported in SDK):
32+
- `az managedcleanroom frontend workloads list`
33+
- `az managedcleanroom frontend analytics deploymentinfo`
34+
- `az managedcleanroom frontend attestation cgs`
35+
- `az managedcleanroom frontend analytics attestationreport cleanroom`
36+
- `az managedcleanroom frontend analytics query vote accept`
37+
- `az managedcleanroom frontend analytics query vote reject`
38+
* BREAKING CHANGE: Consent action values changed from 'accept/reject' to 'enable/disable'
39+
* BREAKING CHANGE: Vote commands consolidated into single unified endpoint
40+
* Added: `az managedcleanroom frontend report` - Comprehensive attestation report (replaces cgs/cleanroom commands)
41+
* Added: `az managedcleanroom frontend oidc set-issuer-url` - Configure OIDC issuer URL
42+
* Added: `az managedcleanroom frontend oidc keys` - Get OIDC signing keys (JWKS)
43+
* Added: `az managedcleanroom frontend analytics dataset queries` - List queries using a specific dataset
44+
* Added: `az managedcleanroom frontend analytics secret set` - Set analytics secrets
45+
* Added: `az managedcleanroom frontend analytics query vote` - Unified vote command with --vote-action parameter
46+
* Updated: Added --active-only filter to collaboration list and show commands
47+
* Updated: Added --pending-only filter to invitation list command
48+
* Updated: Added --scope, --from-seqno, --to-seqno filters to audit event list command
49+
* Updated: Response structures modernized (many list endpoints now return structured objects with value arrays)

src/managedcleanroom/azext_managedcleanroom/_frontend_auth.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ def get_frontend_token(cmd):
3030
profile = Profile(cli_ctx=cmd.cli_ctx)
3131
subscription = get_subscription_id(cmd.cli_ctx)
3232

33-
# Priority 0: explicit token via environment variable (for local/test envs only)
33+
# Priority 0: explicit token via environment variable (for local/test envs
34+
# only)
3435
env_token = os.environ.get('MANAGEDCLEANROOM_ACCESS_TOKEN')
3536
if env_token:
36-
logger.warning("Using token from MANAGEDCLEANROOM_ACCESS_TOKEN env var FOR TESTING PURPOSES ONLY")
37+
logger.warning(
38+
"Using token from MANAGEDCLEANROOM_ACCESS_TOKEN env var FOR TESTING PURPOSES ONLY")
3739
from collections import namedtuple
3840
AccessToken = namedtuple('AccessToken', ['token', 'expires_on'])
3941
token_obj = AccessToken(token=env_token, expires_on=0)
@@ -87,7 +89,7 @@ def set_frontend_config(cmd, endpoint):
8789
endpoint)
8890

8991

90-
def get_frontend_client(cmd, endpoint=None):
92+
def get_frontend_client(cmd, endpoint=None, api_version=None):
9193
"""Create Analytics Frontend API client with Azure authentication
9294
9395
Uses Profile.get_raw_token() to fetch access token from Azure context.
@@ -96,12 +98,18 @@ def get_frontend_client(cmd, endpoint=None):
9698
:param cmd: CLI command context
9799
:param endpoint: Optional explicit endpoint URL (overrides config)
98100
:type endpoint: str
101+
:param api_version: Optional API version (defaults to 2026-03-01-preview)
102+
:type api_version: str
99103
:return: Configured AnalyticsFrontendAPI client
100104
:raises: CLIError if token fetch fails or endpoint not configured
101105
"""
102106
from .analytics_frontend_api import AnalyticsFrontendAPI
103107
from azure.core.pipeline.policies import BearerTokenCredentialPolicy, SansIOHTTPPolicy
104108

109+
# Use provided api_version or default
110+
if api_version is None:
111+
api_version = '2026-03-01-preview'
112+
105113
api_endpoint = endpoint or get_frontend_config(cmd)
106114
if not api_endpoint:
107115
raise CLIError(
@@ -172,5 +180,6 @@ def on_request(self, request):
172180
# Return configured client
173181
return AnalyticsFrontendAPI(
174182
endpoint=api_endpoint,
183+
api_version=api_version,
175184
authentication_policy=auth_policy
176185
)

src/managedcleanroom/azext_managedcleanroom/_frontend_commands.py

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ def load_frontend_command_table(loader, _):
2626
# Show command at frontend level (requires --collaboration-id)
2727
with loader.command_group('managedcleanroom frontend', custom_command_type=frontend_custom) as g:
2828
g.custom_show_command('show', 'frontend_collaboration_show')
29-
30-
# Workloads commands
31-
with loader.command_group('managedcleanroom frontend workloads', custom_command_type=frontend_custom) as g:
32-
g.custom_command('list', 'frontend_collaboration_workloads_list')
29+
g.custom_show_command('report', 'frontend_collaboration_report_show')
3330

3431
# Analytics commands
3532
with loader.command_group('managedcleanroom frontend analytics', custom_command_type=frontend_custom) as g:
3633
g.custom_show_command('show', 'frontend_collaboration_analytics_show')
37-
g.custom_command(
38-
'deploymentinfo',
39-
'frontend_collaboration_analytics_deploymentinfo')
4034
g.custom_command(
4135
'cleanroompolicy',
4236
'frontend_collaboration_analytics_cleanroompolicy')
4337

4438
# OIDC commands
39+
with loader.command_group('managedcleanroom frontend oidc', custom_command_type=frontend_custom) as g:
40+
g.custom_command(
41+
'set-issuer-url',
42+
'frontend_collaboration_oidc_set_issuer_url')
43+
g.custom_show_command('keys', 'frontend_collaboration_oidc_keys_show')
44+
45+
# Keep issuerinfo for backwards compatibility
4546
with loader.command_group('managedcleanroom frontend oidc issuerinfo', custom_command_type=frontend_custom) as g:
4647
g.custom_show_command(
4748
'show', 'frontend_collaboration_oidc_issuerinfo_show')
@@ -57,6 +58,9 @@ def load_frontend_command_table(loader, _):
5758
g.custom_command('list', 'frontend_collaboration_dataset_list')
5859
g.custom_show_command('show', 'frontend_collaboration_dataset_show')
5960
g.custom_command('publish', 'frontend_collaboration_dataset_publish')
61+
g.custom_command(
62+
'queries',
63+
'frontend_collaboration_dataset_queries_list')
6064

6165
# Consent commands
6266
with loader.command_group('managedcleanroom frontend consent', custom_command_type=frontend_custom) as g:
@@ -69,13 +73,7 @@ def load_frontend_command_table(loader, _):
6973
g.custom_show_command('show', 'frontend_collaboration_query_show')
7074
g.custom_command('publish', 'frontend_collaboration_query_publish')
7175
g.custom_command('run', 'frontend_collaboration_query_run')
72-
73-
# Query vote commands
74-
with loader.command_group(
75-
'managedcleanroom frontend analytics query vote',
76-
custom_command_type=frontend_custom) as g:
77-
g.custom_command('accept', 'frontend_collaboration_query_vote_accept')
78-
g.custom_command('reject', 'frontend_collaboration_query_vote_reject')
76+
g.custom_command('vote', 'frontend_collaboration_query_vote')
7977

8078
# Query run history commands
8179
with loader.command_group(
@@ -97,16 +95,9 @@ def load_frontend_command_table(loader, _):
9795
custom_command_type=frontend_custom) as g:
9896
g.custom_command('list', 'frontend_collaboration_audit_list')
9997

100-
# Attestation commands
101-
with loader.command_group('managedcleanroom frontend attestation', custom_command_type=frontend_custom) as g:
102-
g.custom_command('cgs', 'frontend_collaboration_attestation_cgs')
103-
104-
with loader.command_group(
105-
'managedcleanroom frontend analytics attestationreport',
106-
custom_command_type=frontend_custom) as g:
107-
g.custom_command(
108-
'cleanroom',
109-
'frontend_collaboration_attestation_cleanroom')
98+
# Analytics secrets command
99+
with loader.command_group('managedcleanroom frontend analytics secret', custom_command_type=frontend_custom) as g:
100+
g.custom_command('set', 'frontend_collaboration_analytics_secret_set')
110101

111102
# Configuration and authentication commands
112103
with loader.command_group('managedcleanroom frontend', custom_command_type=frontend_custom) as g:

0 commit comments

Comments
 (0)