-
Notifications
You must be signed in to change notification settings - Fork 70
/
azure.datafactory.tools.psm1
45 lines (39 loc) · 1.74 KB
/
azure.datafactory.tools.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
#
# Script module for module 'Azure.DataFactory.Tools' that is executed when 'Azure.DataFactory.Tools' is imported in a PowerShell session.
#
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
if ($true -and ($PSEdition -eq 'Desktop'))
{
if ($PSVersionTable.PSVersion -lt [Version]'5.1')
{
throw "PowerShell versions lower than 5.1 are not supported in Az. Please upgrade to PowerShell 5.1 or higher."
}
}
if (Test-Path -Path "$PSScriptRoot\private" -ErrorAction Ignore)
{
Get-ChildItem "$PSScriptRoot\private" -ErrorAction Stop | Where-Object { $_.Extension -eq '.ps1' } | ForEach-Object {
Write-Verbose "Importing cmdlet '$($_.Name)'."
. $_.FullName
}
}
if (Test-Path -Path "$PSScriptRoot\public" -ErrorAction Ignore)
{
Get-ChildItem "$PSScriptRoot\public" -ErrorAction Stop | Where-Object { $_.Extension -eq '.ps1' } | ForEach-Object {
Write-Verbose "Importing cmdlet '$($_.Name)'."
. $_.FullName
}
}
$moduleName = 'Az.DataFactory'
$module = Get-Module $moduleName
$minVer = "1.10.0"
if ($null -ne $module -and $module.Version -lt [System.Version]$minVer)
{
Write-Error "This module requires $moduleName version $minVer. An earlier version of $moduleName is imported in the current PowerShell session. Please open a new session before importing this module. This error could indicate that multiple incompatible versions of the Azure PowerShell cmdlets are installed on your system. Please see https://aka.ms/azps-version-error for troubleshooting information." -ErrorAction Stop
}
elseif ($null -eq $module)
{
Write-Host "Importing module $module (> $minVer)..."
Import-Module -Name $moduleName -MinimumVersion "$minVer" -Scope Global
Write-Host "Module imported."
}