skip to Main Content

I have enabled the identity in azure web app, it has created one object id. I want to pull the object id using PowerShell, like that I want to pull all the app service using powershell command

3

Answers


  1. Chosen as BEST ANSWER

    Finally I got the answer for this. I try to get my identity id in my webapp, so to get this using below command in PowerShell

    Command:

    az webapp identity show --name yourwebappname --resource-group resrourcegroupname --query principalId
    

    Example:

    az webapp identity show --name ph-prod-blue-portal --resource-group test_resource --query principalId
    

    you will get the below result

    "abc-def-ghi-ijk-lnmkop"
    

  2. You could use this command:

    (Get-AzWebApp -Name <Your_WebApp_Name> -ResourceGroupName <Your_ResourceGroup>).Identity.PrincipalId
    
    Login or Signup to reply.
    • As per this MSDoc, we have alternate command to get the Azure WebApp Service Principal ID.

    Display name must be your WebApp Name

     Get-AzADServicePrincipal -DisplayName "Core52022"
    

    enter image description here

    • To check whether you got the correct ID, you can verify it in Azure Active Directory
      Navigate to the Portal => Azure AD => Enterprise applications,remove all the filters and in search box type your Web App name

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search