You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This request provides a step-by-step explanation for replacing the deprecated AzureADPreview PowerShell module with the Microsoft Graph PowerShell SDK in an Azure Function. Azure Functions run on PowerShell Core (v7.x), which is incompatible with AzureADPreview, necessitating this migration.
Using the Microsoft Graph SDK enables retrieving and processing disabled Azure AD user accounts dynamically, as demonstrated in the sample function demofunc1811.
Correction Details
This guide outlines:
How to enable system-assigned managed identity for an Azure Function.
How to grant Microsoft Graph API permissions required for the function.
How to use the Microsoft Graph SDK to replace AzureADPreview for retrieving disabled user accounts.
Steps
Prerequisites:
Create an Azure Function App.
Enable the system-assigned managed identity in the Function App.
Grant required API permissions to the managed identity:
Directory.Read.All
AuditLog.Read.All
These permissions should be granted with admin consent, as shown in the portal's Enterprise Application permissions page.
Steps to Migrate AzureADPreview to Microsoft Graph SDK
Update requirements.psd1 File
Add the following dependencies to the requirements.psd1 file of the Azure Function:
Documentation Reference:
Azure Functions Managed Dependencies for PowerShell
Microsoft Graph PowerShell SDK
Overview:
This request provides a step-by-step explanation for replacing the deprecated AzureADPreview PowerShell module with the Microsoft Graph PowerShell SDK in an Azure Function. Azure Functions run on PowerShell Core (v7.x), which is incompatible with AzureADPreview, necessitating this migration.
Using the Microsoft Graph SDK enables retrieving and processing disabled Azure AD user accounts dynamically, as demonstrated in the sample function demofunc1811.
Correction Details
This guide outlines:
Steps
Prerequisites:
These permissions should be granted with admin consent, as shown in the portal's Enterprise Application permissions page.
Steps to Migrate AzureADPreview to Microsoft Graph SDK
Add the following dependencies to the requirements.psd1 file of the Azure Function:
Replace the content of
run.ps1
in your Azure Function with the following script:After updating the dependencies and script, restart the Azure Function to apply the changes.
Conclusion
By following this guide, users can:
This correction ensures compatibility with PowerShell Core in Azure Functions while maintaining security and functionality.
The text was updated successfully, but these errors were encountered: