-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSetup.ps1
More file actions
30 lines (26 loc) · 1.11 KB
/
Setup.ps1
File metadata and controls
30 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Check if Microsoft.Graph module is installed
if (-not (Get-Module -ListAvailable Microsoft.Graph)) {
Write-Host "Microsoft Graph module is not installed. Installing..."
Install-Module Microsoft.Graph -Scope CurrentUser -Force
} else {
Write-Host "Microsoft Graph module is already installed."
}
#Check if Microsoft.Graph.Beta module is installed
if (-not (Get-Module -ListAvailable Microsoft.Graph.Beta)) {
Write-Host "Microsoft Graph Beta module is not installed. Installing..."
Install-Module Microsoft.Graph.Beta -Scope CurrentUser -Force
} else {
Write-Host "Microsoft Graph Beta module is already installed."
}
#Check if the Az.ResourceGraph module is installed
$moduleInstalled = Get-InstalledModule -Name 'Az.ResourceGraph' -ErrorAction SilentlyContinue
if ($moduleInstalled) {
Write-Host "Az.ResourceGraph module is already installed."
} else {
# Install the module
Install-Module -Name Az.ResourceGraph -Scope CurrentUser -Repository PSGallery -Force
Write-Host "Az.ResourceGraph module has been installed."
}
#Authenticate to Azure
Import-Module Az -verbose
Connect-AzAccount