01 Run functionapp list command (Windows/macOS/Linux) using custom query filters to list the name and the associated resource group for each Azure Function App available in the current subscription:
az functionapp list
--output table
--query '[*].{name:name, resourceGroup:resourceGroup}'
02 The command output should return the requested Function App names:
Name ResourceGroup
---------------------- ------------------------------
cc-main-function-app cloud-shell-storage-westeurope
cc-project5-function-app cloud-shell-storage-westeurope
03 Run functionapp show command (Windows/macOS/Linux) using the name of the Azure Function App that you want to examine and its associated resource group as the identifier parameters to describe the user-assigned managed identities associated with the selected Function App:
az functionapp show
--name cc-main-function-app
--resource-group cloud-shell-storage-westeurope
--query 'identity.userAssignedIdentities'
04 The command output should return the information available for the associated identities (including the identity full ID and the ID of the associated principal):
{
"/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourcegroups/cloud-shell-storage-westeurope/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cc-main-function-identity": {
"clientId": "abcdabcd-1234-abcd-1234-abcdabcdabcd",
"principalId": "abcd1234-abcd-1234-abcd-1234abcd1234"
}
}
05 Run role assignment list command (Windows/macOS/Linux) using the ID of the principal associated with your user-assigned managed identity as the identifier parameter to describe the role assignments for the selected principal:
az role assignment list
--assignee abcd1234-abcd-1234-abcd-1234abcd1234
--all
06 The command output should return the role assignments for the selected principal:
[
{
"roleDefinitionName": "User Access Administrator",
"roleDefinitionId": "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/providers/Microsoft.Authorization/roleDefinitions/1234abcd-1234-abcd-1234-abcd1234abcd",
"condition": null,
"conditionVersion": null,
"createdBy": "1234abcd-1234-abcd-1234-abcd1234abcd",
"createdOn": "2023-09-12T12:35:11.479547+00:00",
"delegatedManagedIdentityResourceId": null,
"description": null,
"name": "1234abcd-1234-abcd-1234-abcd1234abcd",
"principalId": "abcd1234-abcd-1234-abcd-1234abcd1234",
"principalName": "1234abcd-1234-abcd-1234-abcd1234abcd",
"principalType": "ServicePrincipal",
"resourceGroup": "cloud-shell-storage-westeurope",
"scope": "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cc-main-function-identity",
"type": "Microsoft.Authorization/roleAssignments",
"updatedBy": "1234abcd-1234-abcd-1234-abcd1234abcd",
"updatedOn": "2023-09-12T12:35:11.479547+00:00"
},
{
"roleDefinitionName": "Owner",
"roleDefinitionId": "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/providers/Microsoft.Authorization/roleDefinitions/1234abcd-1234-abcd-1234-abcd1234abcd",
"condition": null,
"conditionVersion": null,
"createdBy": "1234abcd-1234-abcd-1234-abcd1234abcd",
"createdOn": "2023-09-12T13:46:41.674300+00:00",
"delegatedManagedIdentityResourceId": null,
"description": null,
"name": "1234abcd-1234-abcd-1234-abcd1234abcd",
"principalId": "abcd1234-abcd-1234-abcd-1234abcd1234",
"principalName": "1234abcd-1234-abcd-1234-abcd1234abcd",
"principalType": "ServicePrincipal",
"resourceGroup": "cloud-shell-storage-westeurope",
"scope": "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourcegroups/cloud-shell-storage-westeurope/providers/microsoft.managedidentity/userassignedidentities/cc-main-function-identity",
"type": "Microsoft.Authorization/roleAssignments",
"updatedBy": "1234abcd-1234-abcd-1234-abcd1234abcd",
"updatedOn": "2023-09-12T13:46:41.674300+00:00"
}
]
Check the
"roleDefinitionName" attribute value for each role assignment returned by the
role assignment list command output to determine if the associated identity has privileged administrator roles such as
"Owner",
"Contributor",
"User Access Administrator", and
"Role Based Access Control Administrator". If one or more privileged administrator roles are assigned to the user-assigned managed identity associated with the Function App, the functions managed with the selected Azure Function App are configured with admin privileges.
07 Repeat step no. 3 - 6 for each Azure Function App available within the current Azure subscription.
08 Repeat steps no. 1 – 7 for each subscription created in your Microsoft Azure cloud account.