Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to login Multi-Factor Authentication to Dynamics 365 using C#

Multi-factor authentication is enabled on the Azure portal, and it will send a OTP whenever I log in to Dynamics 365. I want to login with MFA in a C# console application.

like image 702
Amit Jesani Avatar asked Oct 18 '18 11:10

Amit Jesani


People also ask

How do I access Multi-Factor Authentication?

In the Microsoft 365 admin center, in the left nav choose Users > Active users. On the Active users page, choose Multi-factor authentication. On the multi-factor authentication page, select each user and set their Multi-Factor auth status to Disabled.

How do I log into Microsoft Dynamics?

Signing in to https://office.comSelect the Dynamics 365 apps tile to go to the Dynamics 365 home page. If you're a system administrator, you'll see an Admin tile.

How does MFA work with Office 365?

By setting up MFA, you add an extra layer of security to your Microsoft 365 account sign-in. For example, you first enter your password and, when prompted, you also type a dynamically generated verification code provided by an authenticator app or sent to your phone.


1 Answers

You can use an App Password for your C# console application.

  1. Login to Office Portal. Click on gear in upper right, click Office 365 under "Your App Settings."
  2. Click on Security & Privacy on left and then Additional Security Verification.
  3. Click Create and manage app passwords.
  4. Click Create and give your password a name (maybe the name of your C# application so you remember it later).
  5. Copy the generated password (it will never be shown again).
  6. Use your normal username and this new password - it will skip multi-factor authentication.

You can create as many App Passwords as you need for legacy apps that don't work with MFA. Try not to reuse them - just create as many as you need. This way you can easily go back and revoke specific passwords when you don't need them any more.

like image 64
Josh Painter Avatar answered Oct 04 '22 08:10

Josh Painter