internal/functions/resolve/Resolve-ResourceGroup.ps1

function Resolve-ResourceGroup {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]
        [string] $InputReference,
        [Parameter(Mandatory = $true)]
        [string] $SubscriptionId,
        [System.Management.Automation.PSCmdlet]
        $Cmdlet = $PSCmdlet
    )

    begin {
        $InputReference = Resolve-String -Text $InputReference
        $secureStringToken = (Get-AzAccessToken -AsSecureString -ResourceUrl $script:apiBaseUrl).Token
        $token = [System.Net.NetworkCredential]::new('', $secureStringToken).Password
    }
    process
    {            
        try { 
            $resourceGroupId = (Invoke-RestMethod -Method GET -uri "$($script:apiBaseUrl)$($SubscriptionId.trimStart("/"))/resourcegroups/$($InputReference)?api-version=2022-01-01" -Headers @{"Authorization"="Bearer $($token)"}).id
            return $resourceGroupId
        }
        catch {
            Write-PSFMessage -Level Warning -String 'AzurePIM.CannotResolveResource' -StringValues "Resource Group" -Tag 'failed' -ErrorRecord $_
            $Cmdlet.ThrowTerminatingError($_)
        }
    }
}