File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
src/ResourceManager/Common/Commands.ResourceManager.Common Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -311,11 +311,19 @@ protected override void Dispose(bool disposing)
311
311
protected override void BeginProcessing ( )
312
312
{
313
313
AzureSession . Instance . ClientFactory . RemoveHandler ( typeof ( RPRegistrationDelegatingHandler ) ) ;
314
- AzureSession . Instance . ClientFactory . AddHandler ( new RPRegistrationDelegatingHandler (
315
- ( ) => new ResourceManagementClient (
316
- DefaultContext . Environment . GetEndpointAsUri ( AzureEnvironment . Endpoint . ResourceManager ) ,
317
- AzureSession . Instance . AuthenticationFactory . GetServiceClientCredentials ( DefaultContext , AzureEnvironment . Endpoint . ResourceManager ) ) ,
318
- s => DebugMessages . Enqueue ( s ) ) ) ;
314
+ if ( DefaultContext != null && DefaultContext . Subscription != null )
315
+ {
316
+ AzureSession . Instance . ClientFactory . AddHandler ( new RPRegistrationDelegatingHandler (
317
+ ( ) =>
318
+ {
319
+ var client = new ResourceManagementClient (
320
+ DefaultContext . Environment . GetEndpointAsUri ( AzureEnvironment . Endpoint . ResourceManager ) ,
321
+ AzureSession . Instance . AuthenticationFactory . GetServiceClientCredentials ( DefaultContext , AzureEnvironment . Endpoint . ResourceManager ) ) ;
322
+ client . SubscriptionId = DefaultContext . Subscription . Id ;
323
+ return client ;
324
+ } ,
325
+ s => DebugMessages . Enqueue ( s ) ) ) ;
326
+ }
319
327
320
328
base . BeginProcessing ( ) ;
321
329
}
You can’t perform that action at this time.
0 commit comments