forked from Azure/Cloud-Katana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CloudKatanaTools.psm1
48 lines (39 loc) · 1.15 KB
/
CloudKatanaTools.psm1
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Importing powershell-yaml
$modulesInstall = @()
if (Get-Module -ListAvailable -Name powershell-yaml) {
if (!(Get-Module powershell-yaml))
{
Import-Module powershell-yaml
}
}
else {
$modulesInstall += 'powershell-yaml'
}
# Import MSAL.PS
if (Get-Module -ListAvailable -Name 'MSAL.PS') {
if (!(Get-Module 'MSAL.PS'))
{
Import-Module 'MSAL.PS'
}
}
else {
$modulesInstall += 'MSAL.PS'
}
if ($modulesInstall) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Register-PSRepository -Default
foreach ($module in $modulesInstall) {
Install-Module $module -Force -AcceptLicense
Import-Module $module
}
}
$scripts = @(Get-ChildItem -Path $PSScriptRoot\resources\scripts\*.ps1 -ErrorAction SilentlyContinue | Where-Object {$_.Name -ne "Add-AzureFunctionCoreTools.ps1"})
foreach ($script in $scripts) {
try {
. $script.FullName
} catch {
Write-Error "Failed to import $($script.FullName): $_"
}
}