none
Login failed for user

    Question

  • Hi

    I am using Azure for the first time & trying to read from an Azure SQL Database.

    Since connecting directly to the database is said to be bad, I've followed this tutorial from microsoft
    https://
    github
    .com/Azure-Samples/app-service-msi-entityframework-dotnet

    I am using the provided project & have changed nothing in it except for the details in the connection string (i.e. server name & db name)
    I have setup an azure API App, Db & Db Server as suggested in the tutorial ("WebApp2105", "WebAppDb", "webapp2105dbserver"). I have then created a managed identity (AAD Admin: "WebAppManagedAdmin", "WebAppAdmin" is the admin of the SQL Server) & altered the connection string using the power shell as suggested.

    Now when debugging or publishing the app, the error "Login failed for user" is thrown. (see: https://
    webapp2105
    .azurewebsites
    .net/ )

    Something else I noticed:
    Before creating the AAD Admin I can connect (Authentication: Active Directory PW) to the db via SSMS using my normal AAD account (the standard AAD domain that was created when I signed up for azure with my microsoft account, btw. is this normal ? I pretty much have 2 accounts now. My email signed up microsoft account + the azure domain account, azure is only active for my email microsoft account though)

    After creating the managed ID, I can no longer connect  using Active Directory authentication. Neither with my AAD domain nor the my WebAppManagedAdmin id.

    Any clues why the login fails & why I can't connect to the db anymore after creating the managed identity ?
    I've checked the trouble shooting paragraph of the tutorial, both environment variables do exist when publishing.


    Edit:
    I've added empty lines because I wasn't allowed to post links...
    Tuesday, May 21, 2019 3:52 PM

All replies