ChrKT
ChrKT

Reputation: 11

Trouble publishing ASP.NET project with Code First database to Azure - Permission

I cannot migrate my Code First database to Azure - Error hints at permission, but I can't figure out what's missing?

When publishing: (Also tried running Visual Studio as administrator)

Result:

What's missing? Should I add a new migration (and delete the old ones)? Is there some problem with commenting out the connection to LocalDb? Is there some setting in Azure I missed?

Upvotes: 0

Views: 426

Answers (1)

ChrKT
ChrKT

Reputation: 11

Well I finally succeeded in migrating my database.

I upgraded Visual Studio 2019 from 16.11.13 to 16.11.14. That's probably not the reason why it worked, but I just note it because I'm not sure what made the difference.

If someone has the same problem I'll try to summarize what worked although I think I have tried the combinations below before:

  • Ran Visual Studio as admin
  • I deleted the previous migrations (made in LocalDB) and added a new
  • The connectionstring only had Data Source/Initial Catalog/User Id/Password - i.e. not MultipleActiveResultSets/Encrypt/TrustServerCertificate/Connection Timeout
  • I ignored KeyVault (and LocalDB) service dependencies
  • New Publishing Profile
  • Published the Web app first (without migration)
  • Chose Apply migration and published again

All seems straight forward so it's a bit of a mystery ?!

Upvotes: 0

Related Questions