Azure DevOps Azure PowerShell Task: Get Current Resource Group

Mike-E-angelo 486 Reputation points
2022-03-14T16:33:17.567+00:00

In my Azure DevOps Release Pipeline I see the following information in a task:

I have bound this task to a service connection that has both a subscription and a resource group.

How do I access this resource group in the inline script?

(this system seriously needs to update its tags btw... azure-devops isn't even a candidate)

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,626 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sudipta Chakraborty - MSFT 1,101 Reputation points Microsoft Employee
    2022-03-14T17:51:00.047+00:00

    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


  2. JamesTran-MSFT 36,481 Reputation points Microsoft Employee
    2022-03-14T21:45:01.973+00:00

    @Mike-E-angelo
    Thank you for your post!
    Azure DevOps is currently not supported here on the Q&A forums, our Azure DevOps experts are actively answering questions in their dedicated forum here:

    https://developercommunity.visualstudio.com/search?space=21

    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.