WEB api + Azure sql server + IIS deploy + NT AUTHORITY\ANONYMOUS LOGON - azure

I have created one WEB Api which has some logic to pull data from SQL
server. When i try to get simple string return from Web Api i am
getting it. but when i am trying to get some data from AZURE Sql DB i
am getting NT AUTHORITY\ANONYMOUS LOGON error.
API- WEB API
DB : AZURE Sql with Authentication=Active Directory
Integrated
Anyone faced this problem anytime before. Please suggest.

My suggestion is to use a Azure Active Directory token based authentication. Download samples here for Azure AD .Net WebApi using Azure AD “on-behalf of token” to connect to Azure SQL Database.
The zip file you will download contains an extensive README file describing the whole setup process step-by-step.

Thanks All going through this question. i got resolved this problem.
In order to solve this issue.
I created One separate App pool --> .net Clr Version4.0
Added Identity With Custom Account
Identity --> Custom Account
In Custom account provided the credentials which i have access to DB.

Related

trying to Deploying asp.net web api to azure app service

i am trying to deploy a asp.net core web api to azure app service
i try signing in with the account i created on azure but it keeps on bring me to the last step
if you find that VS always aksed you to sign in, but you've entered the user name and password, then pls close the publish window, and open it again. I faced the same issue before, so it may help you.

You do not have permission to view this directory or page

I have created a new MVC application with windows authentication and without doing any changes to application, I have deployed to Azure App Service.
When I browse the URL I am getting the message as "You do not have permission to view this directory or page.".
When I check the "DetailedErrors" folder, it was "IIS Detailed Error - 401.0 - Unauthorized".
I have referred many post with this issue. But none of the solution mentioned in the post solved my issue.
Please let me know what configuration I am missing.
Thanks
Windows authentication is not supported in App Service.
In order for IWA to work, the server would need to be AD joined.
You do not have that level of access in App Service.
https://devblogs.microsoft.com/premier-developer/moving-legacy-asp-net-apps-with-windows-authentication-to-azure-app-service-part-1/
You will have to migrate to e.g. Azure AD authentication or host the app on a platform that supports IWA.

Azure Devops release pipeline unauthorized for some projects

I am trying to release multiple projects in 1 solution using Azure Release pipeline
They are all connected to the same Azure Subscription, but some do deploy to the given app service while others give an unauthorized error.
Ive looked into it and i read that adding website_webdeploy_use_scm to the app service should help the Unauthorized error, but this didnt help for me.
What else could i look at? I connect through Azure Devops so i just selected the subscription from the list it automatically gathers from Azure because im logged in using the same logins as i use for Azure Portal
the full error is:
Connected to the remote computer ("xxxx.azurewebsites.windows.net") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error: The remote server returned an error: (401) Unauthorized.
according to the error I'd suggest you check service principal permissions. it probably lacks the permissions required to manage those webapps.
So after refresh publishing profile in Azure Portal and trying it again it fixed itself so im not sure if that caused it or not but it worked!
another fix is to delete the slot and make it again

Azure Active Directory Connection String

I've been trying to set up my IIS website's connection string to connect to an Azure SQL Database with the following connection string:
<add name="ConnectionString" connectionString="Server=tcp:some.database.windows.net,1433;Database=myDB;Authentication=Active Directory Integrated;" />
The IIS application pool is using a service account which has Azure Active Directory privileges and is added as an user on the Azure SQL Database.
This works fine on my local development machine (probably because it is using my credentials and not a service account) but when I place the site on IIS I get:
System.ArgumentException: Keyword not supported: 'authentication'.
Does anyone know the correct syntax for logging in via Azure AD?
Have you been through this troubleshooting guide, https://azure.microsoft.com/en-us/documentation/articles/sql-database-aad-authentication/#5-configure-your-client-computers?
In particular, do you have .NET Framework 4.6 or later installed?

Creation of Microsoft Azure Web App with sql server failed

I've been attempting to create a new MVC web application in visual studio and have it hosted in Microsoft Azure. If I choose to have a database server it fails with the following error.
Creating Microsoft Azure Web App
Creation of Microsoft Azure Web App failed. Object reference not set to an instance of an object.
If I don't select the option to have a database the web site is created in my azure account.
Can anyone tell me what this error is suppose to mean.
Make sure you are using the latest SDK version. There was a bug in 2.5.1 that is fixed in 2.6. Also make sure you're creating the database in the same resource group as the web app.

Resources