File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
ResourceManager/Resources/Commands.Resources/Models.ResourceGroups Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ protected static AzureProfile InitializeDefaultProfile()
97
97
return new AzureProfile ( ) ;
98
98
}
99
99
100
+ /// <summary>
101
+ /// Get the context the context for the current profile before BeginProcessing is called
102
+ /// </summary>
103
+ /// <returns>The context for the current profile</returns>
104
+ protected AzureContext GetCurrentContext ( )
105
+ {
106
+ if ( Profile != null )
107
+ {
108
+ return Profile . Context ;
109
+ }
110
+
111
+ return CurrentProfile . Context ;
112
+ }
113
+
100
114
protected static void InitializeTokenCaches ( )
101
115
{
102
116
DefaultMemoryTokenCache = new TokenCache ( ) ;
Original file line number Diff line number Diff line change @@ -53,12 +53,9 @@ public GalleryTemplatesClient GalleryTemplatesClient
53
53
{
54
54
if ( galleryTemplatesClient == null )
55
55
{
56
- if ( Profile == null )
57
- {
58
- Profile = new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ;
59
- }
60
-
61
- galleryTemplatesClient = new GalleryTemplatesClient ( Profile . Context ) ;
56
+ // since this accessor can be called before BeginProcessing, use GetCurrentContext if no
57
+ // profile is passed in
58
+ galleryTemplatesClient = new GalleryTemplatesClient ( GetCurrentContext ( ) ) ;
62
59
}
63
60
return galleryTemplatesClient ;
64
61
}
You can’t perform that action at this time.
0 commit comments