You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/integration/all-resource-types/run-roundtrip-phase5-compare.ps1
+17-2Lines changed: 17 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,6 @@
6
6
7
7
[CmdletBinding()]
8
8
param(
9
-
[Parameter(Mandatory)]
10
9
[string]$SourceSubscriptionId,
11
10
12
11
[Parameter(Mandatory)]
@@ -15,7 +14,6 @@ param(
15
14
[Parameter(Mandatory)]
16
15
[string]$SourceApimName,
17
16
18
-
[Parameter(Mandatory)]
19
17
[string]$TargetSubscriptionId,
20
18
21
19
[Parameter(Mandatory)]
@@ -39,6 +37,23 @@ if (-not (Test-Path $compareScript)) {
39
37
exit2
40
38
}
41
39
40
+
if ([string]::IsNullOrWhiteSpace($SourceSubscriptionId)) {
41
+
$SourceSubscriptionId=$env:SOURCE_SUBSCRIPTION_ID
42
+
}
43
+
if ([string]::IsNullOrWhiteSpace($TargetSubscriptionId)) {
44
+
$TargetSubscriptionId=$env:TARGET_SUBSCRIPTION_ID
45
+
}
46
+
47
+
if ([string]::IsNullOrWhiteSpace($SourceSubscriptionId) -or [string]::IsNullOrWhiteSpace($TargetSubscriptionId)) {
48
+
$account= az account show --output json 2>$null|ConvertFrom-Json
49
+
if (-not$account-or-not$account.id) {
50
+
Write-Error"Unable to resolve subscription IDs for compare phase. Set -SourceSubscriptionId/-TargetSubscriptionId, SOURCE_SUBSCRIPTION_ID/TARGET_SUBSCRIPTION_ID, or run 'az login'."
51
+
exit2
52
+
}
53
+
if ([string]::IsNullOrWhiteSpace($SourceSubscriptionId)) { $SourceSubscriptionId=$account.id }
54
+
if ([string]::IsNullOrWhiteSpace($TargetSubscriptionId)) { $TargetSubscriptionId=$account.id }
55
+
}
56
+
42
57
Write-Host"🔍 Compare — Compare source and target APIM instances"
0 commit comments