Created
June 25, 2020 09:51
-
-
Save masyanru/ca7c1575fc653097eafae70024c0e33b to your computer and use it in GitHub Desktop.
Azure Migration Checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$false)] | |
[string]$SubsID, | |
[Parameter(Mandatory=$true)] | |
[string]$RGName | |
) | |
if($SubsID) | |
{ | |
Connect-AzAccount -Subscription $SubsID | Out-Null | |
} | |
else { | |
Connect-AzAccount | Out-Null | |
} | |
$res = Invoke-WebRequest -Uri https://raw.githubusercontent.com/tfitzmac/resource-capabilities/master/move-support-resources.csv -Method Get | |
$list = Convertfrom-csv -InputObject $res.Content | |
$resObjs = Get-AzResource -ResourceGroupName $RGName | |
foreach($obj in $resObjs) | |
{ | |
$resName = $obj.Name | |
$resType = $obj.ResourceType | |
$resID = $obj.ResourceId | |
$resList = $list -match $obj.ResourceType | |
if($resList) | |
{ | |
$i = [int]$resList[0].'Move Subscription' | |
if($i -ne 1) | |
{ | |
Write-Host "`n`t***`tOBJECT CAN _NOT_ BE MIGRATED: $resName has type $resType ($resID)" -ForegroundColor Yellow -BackgroundColor DarkRed | |
} | |
else { | |
Write-Host "`nOBJECT SUPPORTED FOR MIGRATION: $resName has type $resType ($resID)" -ForegroundColor Green | |
} | |
} | |
else { | |
Write-Host "UNKNOWN OBJECT's TYPE: $resName has type $resType ($resID)" -ForegroundColor DarkRed -BackgroundColor Yellow | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment