Skip to content

Instantly share code, notes, and snippets.

@masyanru
Created June 25, 2020 09:51
Show Gist options
  • Save masyanru/ca7c1575fc653097eafae70024c0e33b to your computer and use it in GitHub Desktop.
Save masyanru/ca7c1575fc653097eafae70024c0e33b to your computer and use it in GitHub Desktop.
Azure Migration Checks
[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