@@ -105,17 +105,18 @@ def cf_kusto_pool(cli_ctx, *_):
105
105
def synapse_spark_factory (cli_ctx , workspace_name , sparkpool_name ):
106
106
from azure .synapse .spark import SparkClient
107
107
from azure .cli .core ._profile import Profile
108
+ # Uncomment this line after SparkClient is fixed. See https://github.com/Azure/azure-cli/pull/30788
109
+ # from azure.cli.core.auth.util import resource_to_scopes
108
110
from azure .cli .core .commands .client_factory import get_subscription_id
109
111
subscription_id = get_subscription_id (cli_ctx )
110
112
profile = Profile (cli_ctx = cli_ctx )
111
- cred , _ , _ = profile .get_login_credentials (
112
- resource = cli_ctx .cloud .endpoints .synapse_analytics_resource_id ,
113
- subscription_id = subscription_id
114
- )
113
+ cred , _ , _ = profile .get_login_credentials (subscription_id = subscription_id )
115
114
return SparkClient (
116
115
credential = cred ,
117
116
endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint ),
118
- spark_pool_name = sparkpool_name
117
+ spark_pool_name = sparkpool_name ,
118
+ # Uncomment this line after SparkClient is fixed
119
+ # credential_scopes=resource_to_scopes(cli_ctx.cloud.endpoints.synapse_analytics_resource_id)
119
120
)
120
121
121
122
@@ -130,16 +131,15 @@ def cf_synapse_spark_session(cli_ctx, workspace_name, sparkpool_name):
130
131
def synapse_accesscontrol_factory (cli_ctx , workspace_name ):
131
132
from azure .synapse .accesscontrol import AccessControlClient
132
133
from azure .cli .core ._profile import Profile
134
+ from azure .cli .core .auth .util import resource_to_scopes
133
135
from azure .cli .core .commands .client_factory import get_subscription_id
134
136
subscription_id = get_subscription_id (cli_ctx )
135
137
profile = Profile (cli_ctx = cli_ctx )
136
- cred , _ , _ = profile .get_login_credentials (
137
- resource = cli_ctx .cloud .endpoints .synapse_analytics_resource_id ,
138
- subscription_id = subscription_id
139
- )
138
+ cred , _ , _ = profile .get_login_credentials (subscription_id = subscription_id )
140
139
return AccessControlClient (
141
140
credential = cred ,
142
- endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint )
141
+ endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint ),
142
+ credential_scopes = resource_to_scopes (cli_ctx .cloud .endpoints .synapse_analytics_resource_id )
143
143
)
144
144
145
145
@@ -160,16 +160,15 @@ def cf_graph_client_factory(cli_ctx, **_):
160
160
def cf_synapse_client_artifacts_factory (cli_ctx , workspace_name ):
161
161
from azure .synapse .artifacts import ArtifactsClient
162
162
from azure .cli .core ._profile import Profile
163
+ from azure .cli .core .auth .util import resource_to_scopes
163
164
from azure .cli .core .commands .client_factory import get_subscription_id
164
165
subscription_id = get_subscription_id (cli_ctx )
165
166
profile = Profile (cli_ctx = cli_ctx )
166
- cred , _ , _ = profile .get_login_credentials (
167
- resource = cli_ctx .cloud .endpoints .synapse_analytics_resource_id ,
168
- subscription_id = subscription_id
169
- )
167
+ cred , _ , _ = profile .get_login_credentials (subscription_id = subscription_id )
170
168
return ArtifactsClient (
171
169
credential = cred ,
172
- endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint )
170
+ endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint ),
171
+ credential_scopes = resource_to_scopes (cli_ctx .cloud .endpoints .synapse_analytics_resource_id )
173
172
)
174
173
175
174
@@ -216,16 +215,15 @@ def cf_synapse_library(cli_ctx, workspace_name):
216
215
def cf_synapse_client_managedprivateendpoints_factory (cli_ctx , workspace_name ):
217
216
from azure .synapse .managedprivateendpoints import VnetClient
218
217
from azure .cli .core ._profile import Profile
218
+ from azure .cli .core .auth .util import resource_to_scopes
219
219
from azure .cli .core .commands .client_factory import get_subscription_id
220
220
subscription_id = get_subscription_id (cli_ctx )
221
221
profile = Profile (cli_ctx = cli_ctx )
222
- cred , _ , _ = profile .get_login_credentials (
223
- resource = cli_ctx .cloud .endpoints .synapse_analytics_resource_id ,
224
- subscription_id = subscription_id
225
- )
222
+ cred , _ , _ = profile .get_login_credentials (subscription_id = subscription_id )
226
223
return VnetClient (
227
224
credential = cred ,
228
- endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint )
225
+ endpoint = '{}{}{}' .format ("https://" , workspace_name , cli_ctx .cloud .suffixes .synapse_analytics_endpoint ),
226
+ credential_scopes = resource_to_scopes (cli_ctx .cloud .endpoints .synapse_analytics_resource_id )
229
227
)
230
228
231
229
0 commit comments