This commit is contained in:
maddieclayton 2018-11-12 15:44:39 -08:00
Родитель 3cd31a1a5e
Коммит 338fbf09b9
3 изменённых файлов: 61 добавлений и 59 удалений

Просмотреть файл

@ -1,4 +1,24 @@
if (!($env:SkipAzInstallationChecks -eq "true"))
function Write-InstallationCheckToFile
{
Param($installationchecks)
if (Get-Module AzureRM.Profile -ListAvailable)
{
Write-Warning "Both Az and AzureRM modules were detected on your machine. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
$installationchecks.Add("AzSideBySideCheck","true")
try
{
Remove-Item -Path $pathToInstallationChecks
New-Item -Path $pathToInstallationChecks -ItemType File -Value ($installationchecks | ConvertTo-Json)
}
catch
{
Write-Verbose "Installation checks failed to write to file."
}
}
if (!($env:SkipAzInstallationChecks -eq "true"))
{
$pathToInstallationChecks = Join-Path (Join-Path $HOME ".Azure") "AzInstallationChecks.json"
if (!(Test-Path $pathToInstallationChecks))
@ -28,12 +48,12 @@
}
catch
{
Write-InstallationCheckToFile
Write-InstallationCheckToFile $installationchecks
}
if (!$installationchecks.ContainsKey("AzSideBySideCheck"))
{
Write-InstallationCheckToFile
Write-InstallationCheckToFile $installationchecks
}
}
}
@ -44,23 +64,4 @@
throw "AzureRM.Profile already loaded. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
Update-TypeData -AppendPath (Join-Path (Get-Item $PSScriptRoot).Parent.FullName Microsoft.Azure.Commands.Profile.types.ps1xml)
function Write-InstallationCheckToFile
{
if (Get-Module AzureRM.Profile -ListAvailable)
{
Write-Warning "Both Az and AzureRM modules were detected on your machine. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
$installationchecks.Add("AzSideBySideCheck","true")
try
{
Remove-Item -Path $pathToInstallationChecks
New-Item -Path $pathToInstallationChecks -ItemType File -Value ($installationchecks | ConvertTo-Json)
}
catch
{
Write-Verbose "Installation checks failed to write to file."
}
}
Update-TypeData -AppendPath (Join-Path (Get-Item $PSScriptRoot).Parent.FullName Microsoft.Azure.Commands.Profile.types.ps1xml)

Просмотреть файл

@ -1,3 +1,23 @@
function Write-InstallationCheckToFile
{
Param($installationchecks)
if (Get-Module Az.Profile -ListAvailable)
{
Write-Warning "Both Az and AzureRM modules were detected on your machine. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
$installationchecks.Add("AzureRmSideBySideCheck","true")
try
{
Remove-Item -Path $pathToInstallationChecks
New-Item -Path $pathToInstallationChecks -ItemType File -Value ($installationchecks | ConvertTo-Json)
}
catch
{
Write-Verbose "Installation checks failed to write to file."
}
}
if (!($env:SkipAzInstallationChecks -eq "true"))
{
$pathToInstallationChecks = Join-Path (Join-Path $HOME ".Azure") "AzInstallationChecks.json"
@ -28,12 +48,12 @@ if (!($env:SkipAzInstallationChecks -eq "true"))
}
catch
{
Write-InstallationCheckToFile
Write-InstallationCheckToFile $installationchecks
}
if (!$installationchecks.ContainsKey("AzureRmSideBySideCheck"))
{
Write-InstallationCheckToFile
Write-InstallationCheckToFile $installationchecks
}
}
}
@ -42,23 +62,4 @@ if (Get-Module Az.profile)
{
Write-Warning "Az.Profile already loaded. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
throw "Az.Profile already loaded. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
function Write-InstallationCheckToFile
{
if (Get-Module Az.Profile -ListAvailable)
{
Write-Warning "Both Az and AzureRM modules were detected on your machine. Az and AzureRM module cannot be run side-by-side, please run 'Uninstall-AzureRm' to remove all AzureRm modules from your machine. More information can be found here: aka.ms/azps-migration-guide"
}
$installationchecks.Add("AzureRmSideBySideCheck","true")
try
{
Remove-Item -Path $pathToInstallationChecks
New-Item -Path $pathToInstallationChecks -ItemType File -Value ($installationchecks | ConvertTo-Json)
}
catch
{
Write-Verbose "Installation checks failed to write to file."
}
}

Просмотреть файл

@ -9,6 +9,21 @@
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
function Test-DotNet
{
try
{
if (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\' | Get-ItemPropertyValue -Name Release | Foreach-Object { $_ -lt 461808 })
{
throw ".NET Framework versions lower than 4.7.2 are not supported in Az. Please upgrade to .NET Framework 4.7.2 or higher."
}
}
catch
{
Write-Verbose ".NET Framework version check failed."
}
}
if (%ISAZMODULE%)
{
if ($PSVersionTable.PSVersion -lt [Version]'5.1')
@ -105,19 +120,4 @@ if ($Env:ACC_CLOUD -eq $null)
})
}
}
}
function Test-DotNet
{
try
{
if (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\' | Get-ItemPropertyValue -Name Release | Foreach-Object { $_ -lt 461808 })
{
throw ".NET Framework versions lower than 4.7.2 are not supported in Az. Please upgrade to .NET Framework 4.7.2 or higher."
}
}
catch
{
Write-Verbose ".NET Framework version check failed."
}
}