Powershell with modern authentication

%3CLINGO-SUB%20id%3D%22lingo-sub-388484%22%20slang%3D%22en-US%22%3EPowershell%20with%20modern%20authentication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-388484%22%20slang%3D%22en-US%22%3ECould%20someone%20guide%20me%20how%20to%20use%20modern%20authentication%20in%20scripts%20making%20connections%20to%20exchange%20online%2Fmsonline%2Fazuread.%20This%20is%20required%20for%20unattended%20powershell%20scripts%20which%20are%20configured%20with%20basic%20authentication%20at%20present.%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-388484%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Active%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-388516%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20with%20modern%20authentication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-388516%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20are%20plenty%20of%20samples%20available%20online%20or%20even%20here%20on%20the%20MTC%2C%20do%20a%20search.%20And%20prepare%20to%20make%20some%20compromises%2C%20as%20there%20are%20no%20perfect%20solutions%20to%20that%20issue%20presently...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-990203%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20with%20modern%20authentication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-990203%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3BCan%20you%20post%20some%20examples%3F%20My%20searches%20are%20finding%20nothing%20relevant.%26nbsp%3B%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-990349%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20with%20modern%20authentication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-990349%22%20slang%3D%22en-US%22%3EOne%20thing%20you%20can%20do%20is%20set%20up%20a%20Conditional%20Access%20for%20your%20scripting%20server%20(requires%20AAD%20P1%20license%20I%20think).%3C%2FLINGO-BODY%3E
Occasional Visitor
Could someone guide me how to use modern authentication in scripts making connections to exchange online/msonline/azuread. This is required for unattended powershell scripts which are configured with basic authentication at present.
3 Replies

There are plenty of samples available online or even here on the MTC, do a search. And prepare to make some compromises, as there are no perfect solutions to that issue presently...

@Vasil Michev Can you post some examples? My searches are finding nothing relevant.  Thanks.

One thing you can do is set up a Conditional Access for your scripting server (requires AAD P1 license I think).