@@ -181,6 +181,12 @@ public static void SetTestSettings()
181
181
CredentialHelper . GetTestSettings ( Resource . TestSettings ) ;
182
182
183
183
vmPowershellCmdlets . RemoveAzureSubscriptions ( ) ;
184
+ var ussouthEnv = vmPowershellCmdlets . GetAzureEnvironment ( "ussouth" ) ;
185
+ if ( ussouthEnv != null && ussouthEnv . Count > 0 )
186
+ {
187
+ Console . WriteLine ( "Removing ussouth environment..." ) ;
188
+ vmPowershellCmdlets . RunPSScript ( "Remove-AzureEnvironment -Name ussouth -Force" ) ;
189
+ }
184
190
185
191
List < PSAzureEnvironment > environments = vmPowershellCmdlets . GetAzureEnvironment ( ) ;
186
192
@@ -221,58 +227,50 @@ public static void SetTestSettings()
221
227
222
228
foreach ( var env in environments )
223
229
{
224
- var envServiceManagementUrl = ( string ) env . Endpoints [ AzureEnvironment . Endpoint . ServiceManagement ] ;
225
-
226
- if ( ! string . IsNullOrEmpty ( envServiceManagementUrl ) )
230
+ if ( ( ! string . IsNullOrEmpty ( env . ServiceManagementUrl ) ) )
227
231
{
228
232
Console . WriteLine ( "The service management URL for evironment {0} is : {1}" , env , serviceManagementUrl ) ;
229
- if ( envServiceManagementUrl . Equals ( serviceManagementUrl ) )
233
+ if ( env . ServiceManagementUrl . Equals ( serviceManagementUrl ) )
230
234
{
231
235
currentEnvName = env . Name ;
232
236
var curEnv = vmPowershellCmdlets . GetAzureEnvironment ( currentEnvName ) [ 0 ] ;
233
237
Console . WriteLine ( "Using the existing environment: {0}" , currentEnvName ) ;
234
- Console . WriteLine ( "PublichSettingsFileUrl: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) ) ;
235
- Console . WriteLine ( "ServiceManagement: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . ServiceManagement ) ) ;
236
- Console . WriteLine ( "ManagementPortalUrl: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . ManagementPortalUrl ) ) ;
237
- Console . WriteLine ( "ActiveDirectory: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) ) ;
238
- Console . WriteLine ( "ActiveDirectoryServiceEndpointResourceId: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) ) ;
239
- Console . WriteLine ( "ResourceManager: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) ) ;
240
- Console . WriteLine ( "Gallery: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . Gallery ) ) ;
241
- Console . WriteLine ( "Graph: {0}" , curEnv . GetEndpoint ( AzureEnvironment . Endpoint . Graph ) ) ;
238
+ Console . WriteLine ( "PublichSettingsFileUrl: {0}" , curEnv . PublishSettingsFileUrl ) ;
239
+ Console . WriteLine ( "ServiceManagement: {0}" , curEnv . ServiceManagementUrl ) ;
240
+ Console . WriteLine ( "ManagementPortalUrl: {0}" , curEnv . ManagementPortalUrl ) ;
241
+ Console . WriteLine ( "ActiveDirectory: {0}" , curEnv . ActiveDirectoryAuthority ) ;
242
+ Console . WriteLine ( "ActiveDirectoryServiceEndpointResourceId: {0}" , curEnv . ActiveDirectoryServiceEndpointResourceId ) ;
243
+ Console . WriteLine ( "ResourceManager: {0}" , curEnv . ResourceManagerUrl ) ;
244
+ Console . WriteLine ( "Gallery: {0}" , curEnv . GalleryUrl ) ;
245
+ Console . WriteLine ( "Graph: {0}" , curEnv . GalleryUrl ) ;
242
246
break ;
243
247
}
244
248
}
245
249
}
246
250
247
251
if ( string . IsNullOrEmpty ( currentEnvName ) )
248
- {
249
- if ( vmPowershellCmdlets . GetAzureEnvironment ( "ussouth" ) . Count > 0 )
250
- {
251
- Console . WriteLine ( "Removing ussouth environment..." ) ;
252
- vmPowershellCmdlets . RunPSScript ( "Remove-AzureEnvironment -Name ussouth -Force" ) ;
253
- }
254
-
252
+ {
255
253
Console . WriteLine ( "Creating new environment... : {0}" , TempEnvName ) ;
256
254
var prodEnv = vmPowershellCmdlets . GetAzureEnvironment ( "AzureCloud" ) [ 0 ] ;
257
255
vmPowershellCmdlets . RunPSScript ( string . Format (
258
256
@"Add-AzureEnvironment -Name {0} `
259
- -PublishSettingsFileUrl {1} `
260
- -ServiceEndpoint {2} `
261
- -ManagementPortalUrl {3} `
262
- -ActiveDirectoryEndpoint {4} `
263
- -ActiveDirectoryServiceEndpointResourceId {5} `
264
- -ResourceManagerEndpoint {6} `
265
- -GalleryEndpoint {7} `
266
- -GraphEndpoint {8}" ,
257
+ -PublishSettingsFileUrl {1} `
258
+ -ServiceEndpoint {2} `
259
+ -ManagementPortalUrl {3} `
260
+ -ActiveDirectoryEndpoint {4} `
261
+ -ActiveDirectoryServiceEndpointResourceId {5} `
262
+ -ResourceManagerEndpoint {6} `
263
+ -GalleryEndpoint {7} `
264
+ -GraphEndpoint {8}" ,
267
265
TempEnvName ,
268
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) ,
266
+ prodEnv . PublishSettingsFileUrl ,
269
267
serviceManagementUrl ,
270
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . ManagementPortalUrl ) ,
271
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) ,
272
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) ,
273
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) ,
274
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . Gallery ) ,
275
- prodEnv . GetEndpoint ( AzureEnvironment . Endpoint . Graph ) ) ) ;
268
+ prodEnv . ManagementPortalUrl ,
269
+ prodEnv . ActiveDirectoryAuthority ,
270
+ prodEnv . ActiveDirectoryServiceEndpointResourceId ,
271
+ prodEnv . ResourceManagerUrl ,
272
+ prodEnv . GalleryUrl ,
273
+ prodEnv . GalleryUrl ) ) ;
276
274
277
275
vmPowershellCmdlets . ImportAzurePublishSettingsFile ( CredentialHelper . PublishSettingsFile , TempEnvName ) ;
278
276
}
0 commit comments