Skip to content

Get-AzResource returns wrong PrincipalId for Function App Staging Slot #12232

@WouterSlob

Description

@WouterSlob

#12026 Description
When using Get-AzResource to get the staging slot of a Function App a resource is returned which has a wrong PrincipalId (in .Identity.PrincipalId). The returned PrincipalId is the principalId of the Function App itself and not the Function App.

For web apps with staging slots the proper principalIds are returned.
When using Get-AzWebApp and Get-AzWebAppSlot also the proper principalIds are returned.

Steps to reproduce

Create a Function App with a staging slot and system identities.

$rg = "resoucegroupname"
$functionApp = "functionappname"
$functionAppStagingSlot = "functionappstagingslotname"
foreach($r in (Get-AzResource -ResourceGroupName $rg -ResourceType "Microsoft.Web/sites")) { 
    Write-Host $r.ResourceName $r.Identity.PrincipalId
}
foreach($r in (Get-AzResource -ResourceGroupName $rg -ResourceType "Microsoft.Web/sites/slots")) { 
    Write-Host $r.ResourceName $r.Identity.PrincipalId
}

Environment data

Windows 10 / Powershell 5.1

Module versions

Az.Resources, version 2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARMMore Info 🏷️customer-reportedquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions