@@ -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 )
0 commit comments