adb.cicd.tools.psm1

#Get Functions and Internal function definition files.
$Functions = @( Get-ChildItem -Path $PSScriptRoot\Functions\*.ps1 -ErrorAction SilentlyContinue )
$Internal = @( Get-ChildItem -Path $PSScriptRoot\Functions\Internal\*.ps1 -ErrorAction SilentlyContinue )

#Dot source the files
Foreach ($import in @($Functions + $Internal)) {
    Try {
        . $import.fullname
    }
    Catch {
        Write-Error -Message "Failed to import function $($import.fullname): $_"
    }
}

$moduleName = "azure.databricks.cicd.tools" 
$minVersion =  "2.2.4042-preview"
# https://github.com/PowerShell/PowerShell/issues/7495
$checkInstalled = Get-InstalledModule -Name $moduleName -MinimumVersion $minVersion -ErrorAction SilentlyContinue -AllowPrerelease
if ($null -eq $checkInstalled) {
    Install-Module -Name $moduleName -RequiredVersion $minVersion -Force -Scope CurrentUser -AllowPrerelease
    
}