This is a basic sample of how to use the azuread PowerShell module within azure functions
Update host.json
setting
{
"functionTimeout": "00:10:00"
}
Setting the application to run as x64 bit: Function App> Configuration > General Settings > Platform > 64 Bit
This is due to a azureAD module requirement
Update requirements.psd1
@{
# For latest supported version, go to 'https://www.powershellgallery.com/packages/Az'.
# To use the Az module in your function app, please uncomment the line below.
'Az.Accounts' = '2.5.4'
'AzureAD' = '2.*'
}
In Azure Active Directory > Roles And Assignments > User Administrator > Add role assignment > Select System Identity of FunctionApp