File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
src/ResourceManager/Profile/Commands.Profile/Environment Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -172,10 +172,12 @@ public override void ExecuteCmdlet()
172
172
GeneralUtilities . EnsureTrailingSlash ( ARMEndpoint ) ? . ToLowerInvariant ( ) , StringComparison . CurrentCultureIgnoreCase ) ) ;
173
173
174
174
IAzureEnvironment newEnvironment = new AzureEnvironment { Name = this . Name } ;
175
- var defProfile = DefaultProfile as AzureRmProfile ;
176
- if ( defProfile != null && defProfile . EnvironmentTable . ContainsKey ( this . Name ) )
175
+ var defProfile = GetDefaultProfile ( ) ;
176
+ if ( defProfile != null )
177
177
{
178
- newEnvironment = defProfile . EnvironmentTable [ Name ] ;
178
+ IAzureEnvironment _newEnvironment ;
179
+ defProfile . TryGetEnvironment ( this . Name , out _newEnvironment ) ;
180
+ newEnvironment = ( _newEnvironment ?? newEnvironment ) ;
179
181
}
180
182
181
183
if ( publicEnvironment . Key == null )
@@ -185,7 +187,7 @@ public override void ExecuteCmdlet()
185
187
{
186
188
EnvHelper = ( EnvHelper == null ? new EnvironmentHelper ( ) : EnvHelper ) ;
187
189
MetadataResponse metadataEndpoints = EnvHelper . RetrieveMetaDataEndpoints ( newEnvironment . ResourceManagerUrl ) . Result ;
188
- string domain = EnvHelper . RetrieveDomain ( newEnvironment . ResourceManagerUrl ) ;
190
+ string domain = EnvHelper . RetrieveDomain ( ARMEndpoint ) ;
189
191
190
192
SetEndpointIfProvided ( newEnvironment , AzureEnvironment . Endpoint . ActiveDirectory ,
191
193
metadataEndpoints . authentication . LoginEndpoint . TrimEnd ( '/' ) + '/' ) ;
Original file line number Diff line number Diff line change @@ -174,10 +174,12 @@ public override void ExecuteCmdlet()
174
174
GeneralUtilities . EnsureTrailingSlash ( ARMEndpoint ) ? . ToLowerInvariant ( ) , StringComparison . CurrentCultureIgnoreCase ) ) ;
175
175
176
176
IAzureEnvironment newEnvironment = new AzureEnvironment { Name = this . Name } ;
177
- var defProfile = DefaultProfile as AzureRmProfile ;
178
- if ( defProfile != null && defProfile . EnvironmentTable . ContainsKey ( this . Name ) )
177
+ var defProfile = GetDefaultProfile ( ) ;
178
+ if ( defProfile != null )
179
179
{
180
- newEnvironment = defProfile . EnvironmentTable [ Name ] ;
180
+ IAzureEnvironment _newEnvironment ;
181
+ defProfile . TryGetEnvironment ( this . Name , out _newEnvironment ) ;
182
+ newEnvironment = ( _newEnvironment ?? newEnvironment ) ;
181
183
}
182
184
183
185
if ( publicEnvironment . Key == null )
@@ -187,7 +189,7 @@ public override void ExecuteCmdlet()
187
189
{
188
190
EnvHelper = ( EnvHelper == null ? new EnvironmentHelper ( ) : EnvHelper ) ;
189
191
MetadataResponse metadataEndpoints = EnvHelper . RetrieveMetaDataEndpoints ( newEnvironment . ResourceManagerUrl ) . Result ;
190
- string domain = EnvHelper . RetrieveDomain ( newEnvironment . ResourceManagerUrl ) ;
192
+ string domain = EnvHelper . RetrieveDomain ( ARMEndpoint ) ;
191
193
192
194
SetEndpointIfProvided ( newEnvironment , AzureEnvironment . Endpoint . ActiveDirectory ,
193
195
metadataEndpoints . authentication . LoginEndpoint . TrimEnd ( '/' ) + '/' ) ;
You can’t perform that action at this time.
0 commit comments