Public/arm.ps1

function Confirm-RKArmResourceIdExists {
    <#
    .Description
    validate a resource exists based on the ResourceId string for example:
        /subscriptions/620f518a-54b6-41dc-9bae-51acf8348345/resourceGroups/redkiote-redkiteps-unittests-rg
    #>

    param([string]$ResourceId)
    if ($ResourceId.Split('/')[-2] -eq "resourceGroups") {
        $Resource = (Get-AzResourceGroup -Id $ResourceId)
    }
    else {
        $Resource = (Get-AzResource -ResourceId $ResourceId -ErrorAction:SilentlyContinue)
    }
    if ($Resource) {
        return $true
    }
    else {
        Write-Warning "Resource $ResourceId not found"
        return $false
    }
}