File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Requires -PSEdition Core
2
2
# Requires -Version 7.0
3
- # Requires -Modules Az
4
3
5
4
<#
6
5
. SYNOPSIS
@@ -134,9 +133,10 @@ function New-MdeServicePrincipal {
134
133
@ {name = ' User.Read.All' ; id = ' ffd6563e-842b-4cfc-b349-06006e0473a3' }
135
134
@ {name = ' Vulnerability.Read' ; id = ' 63a677ce-818c-4409-9d12-5c6d2e2a6bfe' }
136
135
)
136
+ try { Get-Command Get-AzContext - ErrorAction Stop } catch { Throw ' Az module not found, please install it and connect to Azure.' }
137
+ $context = (Get-AzContext )
137
138
}
138
139
Process {
139
- $context = (Get-AzContext )
140
140
if ($context ) {
141
141
$sp = New-AzADServicePrincipal - DisplayName $name
142
142
# Wait for Azure AD
@@ -177,7 +177,7 @@ function New-MdeServicePrincipal {
177
177
}
178
178
}
179
179
else {
180
- Throw ' No active Az session found, please execute Connect-AzAccount first.'
180
+ Throw ' No active Az session found, please run Connect-AzAccount first.'
181
181
}
182
182
}
183
183
End {}
You can’t perform that action at this time.
0 commit comments