Scaffold-DbContext probleme authentication integrated security

jimomo 20 Reputation points
2023-01-19T09:39:59.9066667+00:00

Hello
I want scaffolding my azure sqserver database, but when i run this command :

Scaffold-DbContext "Server=MydataBase.database.windows.net;Database=dev-base;Integrated security=true;Authentication=Active Directory Integratd;User ID=myUser;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

I have this error : Cannot use 'Authentication' with 'Integrated Security'

Someone can help me ?

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
697 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,714 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,473 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 101K Reputation points MVP
    2023-01-19T22:45:58.2166667+00:00

    You have a wee bit too many things in your connection string (which is also what the error message is telling you).

    You have:

    1. Integrated security=true;
    2. Authentication=Active Directory Integratd;User ID=myUser;
    3. Trusted_Connection=True;

    The first and the third mean the same. The second is in contradiction to the other to. Decide which authentication method you want and remove the rest.

    3 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 40,816 Reputation points
    2023-01-19T10:15:02.4066667+00:00

    I have this error : Cannot use 'Authentication' with 'Integrated Security'

    "Integrated Security" means to logon with a local Active Domain account; that's not supported by Azure SQL. You have to choose an other authentication method, see

    An overview of Azure SQL Database and SQL Managed Instance security capabilities

    1 person found this answer helpful.