SOLVED

Consume Active Directory On-Premuses from Azure Function

%3CLINGO-SUB%20id%3D%22lingo-sub-3184177%22%20slang%3D%22es-ES%22%3EConsume%20Active%20Directory%20On-Premuses%20from%20Azure%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3184177%22%20slang%3D%22es-ES%22%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%225%22%3E%3CSTRONG%3EIntroduction%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3EI%20have%20to%20develop%20a%20functionality%20for%20an%20Power%20App%2C%20this%20powerapps%20have%20to%20disable%20or%20enable%20user%20accounts%20in%20the%20On-Premises%20Active%20Directory%20for%20it%20I%20was%20thinking%20to%20create%20an%20Azure%20Functions%20that%20consume%20this%20through%20and%20Hybrid%20Connection%20or%20VPN.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20reseraching%20but%20I'm%20not%20clear%20which%20aproach%20is%20the%20best.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ECan%20I%20connect%20my%20Azure%20Function%20to%20the%20AD%20and%20use%20Powershell%20to%20take%20actions%20in%20the%20AD%3F%3C%2FLI%3E%3CLI%3EWhat%20I%20should%20use%2C%20Hybrid%20Connections%20or%20I%20should%20use%20VPN%3F%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3184177%22%20slang%3D%22es-ES%22%3E%3CLINGO-LABEL%3EActive%20Directory%20(AD)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EApp%20Connectors%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3184756%22%20slang%3D%22en-US%22%3ERe%3A%20Consume%20Active%20Directory%20On-Premuses%20from%20Azure%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3184756%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20case%20it%20is%20on-premise%20Active%20Directory%20(not%20Azure)%20%2C%20then%20you%20may%20use%20commands%20like%20%3CSTRONG%3EDisable-ADAccount%3C%2FSTRONG%3E%20or%26nbsp%3B%3CSTRONG%3EEnable-ADAccount%26nbsp%3B%3C%2FSTRONG%3Ein%20the%20PowerShell%20to%20do%20it%20and%20you%20may%20perform%20a%20complete%20automation%20using%20PowerShell.%20However%2C%20in%20case%20you%20have%20to%20use%20PowerApps%2C%20then%20include%20such%20scripts%20in%20the%26nbsp%3B%3CSTRONG%3EWindows%20recorder%20(V1)%20flows%3C%2FSTRONG%3E%2C%20take%20a%20look%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpower-automate%2Fdesktop-flows%2Fcreate-desktop%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELearn%20to%20create%20Windows%20recorder%20(V1)%20flows%20-%20Power%20Automate%20%7C%20Microsoft%20Docs%3C%2FA%3E.%3C%2FP%3E%3CP%3EYou%20may%20learn%20more%20about%20those%20PowerShell%20commands%20on%20the%20following%20websites%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Factivedirectory%2Fdisable-adaccount%3Fview%3Dwindowsserver2022-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDisable-ADAccount%20(ActiveDirectory)%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Factivedirectory%2Fenable-adaccount%3Fview%3Dwindowsserver2022-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEnable-ADAccount%20(ActiveDirectory)%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

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!

 

 

1 Reply
best response confirmed by sergi2495 (Occasional Contributor)
Solution

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 Learn to create Windows recorder (V1) flows - Power Automate | Microsoft Docs.

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

Disable-ADAccount (ActiveDirectory) | Microsoft Docs

Enable-ADAccount (ActiveDirectory) | Microsoft Docs