Forum Discussion

sergi2495's avatar
sergi2495
Copper Contributor
Feb 18, 2022
Solved

Consume Active Directory On-Premuses from Azure Function

Hello everyone,

 

Introduction

I have to develop a functionality for an Power App, this powerapps have to disable or enable user accounts in the On-Premises Active Directory for it I was thinking to create an Azure Functions that consume this through and Hybrid Connection or VPN. 

 

I was reseraching but I'm not clear which aproach is the best. 

 

  • Can I connect my Azure Function to the AD and use Powershell to take actions in the AD?
  • What I should use, Hybrid Connections or I should use VPN?

 

Thanks in advance!

 

 

  • In case it is on-premise Active Directory (not Azure) , then you may use commands like Disable-ADAccount or Enable-ADAccount in the PowerShell to do it and you may perform a complete automation using PowerShell. However, in case you have to use PowerApps, then include such scripts in the Windows recorder (V1) flows, take a look at https://docs.microsoft.com/en-us/power-automate/desktop-flows/create-desktop.

    You may learn more about those PowerShell commands on the following websites:

    https://docs.microsoft.com/en-us/powershell/module/activedirectory/disable-adaccount?view=windowsserver2022-ps

    https://docs.microsoft.com/en-us/powershell/module/activedirectory/enable-adaccount?view=windowsserver2022-ps

     

1 Reply

  • Reza_Ameri's avatar
    Reza_Ameri
    Silver Contributor

    In case it is on-premise Active Directory (not Azure) , then you may use commands like Disable-ADAccount or Enable-ADAccount in the PowerShell to do it and you may perform a complete automation using PowerShell. However, in case you have to use PowerApps, then include such scripts in the Windows recorder (V1) flows, take a look at https://docs.microsoft.com/en-us/power-automate/desktop-flows/create-desktop.

    You may learn more about those PowerShell commands on the following websites:

    https://docs.microsoft.com/en-us/powershell/module/activedirectory/disable-adaccount?view=windowsserver2022-ps

    https://docs.microsoft.com/en-us/powershell/module/activedirectory/enable-adaccount?view=windowsserver2022-ps

     

Resources