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
$answer=Read-Host"`n'Az' module detected, script requires 'Enable-AzureRmAlias' to be enabled for this session.`n`nType 'Y' to Enable or Press Enter for Exit`n"
92
-
switch($answer){
93
-
Y {
94
-
try {
95
-
Write-Host"`nExecuting 'Enable-AzureRmAlias -Scope Local' to created Aliases, this will not persist outside of this session.`n"
96
-
Enable-AzureRmAlias-Scope Local
97
-
} catch {
98
-
Write-Host-ForegroundColor Red "Error: $($error[0].Exception.Message)"
99
-
throw"Error executing 'Enable-AzureRmAlias'"
100
-
}
101
-
}
102
-
$null {
103
-
Write-Host"Script exiting..."
104
-
Return
105
-
}
106
-
default {
107
-
Write-Host"Script exiting..."
108
-
Return
109
-
}
110
-
}
111
-
} else {
112
-
throw"Error: This script requires either the 'AzureRM' or 'Az' PowerShell Module to be installed."
113
-
}
87
+
throw"Error: This script requires 'Az' PowerShell Module to be installed."
114
88
}
115
89
116
90
# If user do not input DefaultProfile
117
91
if ($null-eq$DefaultProfile) {
118
-
$script:context=Get-AzureRmContext
92
+
$script:context=Get-AzContext
119
93
}
120
94
else {
121
95
$script:context=$DefaultProfile.Context
122
96
}
123
97
124
-
# if user hadn't added and login to AzureRmEnvironment, exit
98
+
# if user hadn't added and login to AzEnvironment, exit
125
99
if ($null-eq$script:context.Account) {
126
-
throw"Please login in AzureRm or Az account first."
100
+
throw"Please login in Az account first."
127
101
}
128
102
129
103
if ((Test-Path-Path $outputLocation) -eq$false) {
@@ -192,13 +166,13 @@ function Get-AzureStackResourceId {
192
166
param (
193
167
)
194
168
try {
195
-
Write-Host"Getting resource Id from AzureRmSubscription."
169
+
Write-Host"Getting resource Id from AzSubscription."
0 commit comments