You can write the following PowerShell script to get the Resource Group in the DevOps pipeline stage:
Get-AzResourceGroup -Name "YourResourceGroupName"
You can check the below link for different PowerShell scripts for getting the Resource Group.
References:
https://learn.microsoft.com/en-us/powershell/module/az.resources/Get-AzResourceGroup?view=azps-7.3.0