I want to scaffold dbcontext efcore in .net 6 web API from Azure Sql Database
Hello,
I have an issue, i'm trying to create models from my existing database which is a azure sql database. now when i run the below command it is giving me object reference not set to an instance error and I don't know what exactly I'm passing as null, one more thing we have azure ad authentication to access database with our accounts. no static passwords.
I have tried to run the below commands and none of them worked and gives me some sort of errors.
Scaffold-DbContext "Data Source=tcp:AzureTestdb.database.windows.net,1433;Authentication=Active Directory Default;Database=Department;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Data Source=tcp:AzureTestdb.database.windows.net,1433;Authentication=Active Directory Integrated;Database=Department;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Data Source=tcp:AzureTestdb.database.windows.net,1433;Authentication=Active Directory Interactive;Database=Department;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Server=tcp:AzureTestdb.database.windows.net,1433;Initial Catalog=Department;Authentication=Active Directory Default;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
can anyone please help me how to setup this scaffold in my visual studio to create models from azure sql database. below is the error i'm getting
Please help me to scaffold the models, thanks in advance.