azure-managed-identity

Login failed for user '<token-identified principal>'. Token is expired when using Azure Function app and Azure SQL Service using Managed Identity

瘦欲@ 提交于 2020-07-22 06:01:06
问题 I am using a function app which is service bus triggered. It connects to Azure SQL Server using Managed Identity . The connection is created using the following code. new SqlConnection(this.ConnectionString) { // AzureServiceTokenProvider handles caching the token and refreshing it before it expires AccessToken = new AzureServiceTokenProvider().GetAccessTokenAsync("https://database.windows.net/").Result }; I get a few thousand events every day, and all these are failing on connecting to the

Access Azure Table Storage with Azure MSI

我的未来我决定 提交于 2020-07-22 04:20:22
问题 I recently setup my .net core application to use MSI (Managed Identity) to communicate with Azure Blob. Does MSI work with Azure Table Storage? Can't seem to find any documentation on it. I am trying to use MSI so I don't have to manage my keys anymore (keyless). 回答1: Azure Table Storage does not support MSI. Table Storage does support Active Directory access. You can find the services that support MSI at the below link... https://docs.microsoft.com/en-us/azure/active-directory/managed

Use managed identities in Azure DevOps build pipeline

青春壹個敷衍的年華 提交于 2020-07-09 05:50:41
问题 I managed to get the below code to work (complete code here) to use Azure managed identity to authenticate (via Visual Studio) and have access to Azure storage account without using credentials. const string storageResource = "https://storage.azure.com/"; var authResult = await azureServiceTokenProvider.GetAuthenticationResultAsync(storageResource, cancellationToken: cancellationToken); The code managed to find my user logged in to Visual Studio and uses it to get the token and all goes well.

User Assigned Identities with App Service and Azure SQL does that work?

只愿长相守 提交于 2020-05-23 11:14:25
问题 I am trying to get App Service to connect with Azure Sql database. I can git is nicely work with System Assigned Identities with the same code, but I prefer to use User Assigned Identities (UAI), but I cannot get it work. Steps which I do: Created a UAI via the portal, name of the UAI "uai-dev-appname-001" At the Identity tab of the Azure App Service I selected 'User Assigned Identity' and selected the UAI made in the previous step. Ran the following SQL CMD CREATE USER [uai-dev-appname-001]

App Service to EntityFramework using MSI

為{幸葍}努か 提交于 2020-05-15 11:01:30
问题 I'm trying to retrofit MSI to an existing app. The original app's DbContext used only a Constructor that found a ConnectionString by the same name in the web.config. I've modified it to use a DbConnectionFactory to inject an AccessToken. public class AppCoreDbContext : DbContext { public AppCoreDbContext() : this("AppCoreDbContext") { } public AppCoreDbContext(string connectionStringOrName) : base( OpenDbConnectionBuilder.Create(connectionStringOrName).Result, true) { } ...etc... } The class

Azure App Service can't access SQL Server - Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

寵の児 提交于 2019-12-25 00:15:11
问题 I have an app service in Azure operating as an API for a system I'm designing. As the API is responsible for accessing the database directly, I obviously don't want to be storing connection strings containing credentials anywhere if possible, so am looking to use Managed Identities to grant the App Service access to the database (also hosted on Azure). Within the Azure portal, I've enabled System-Assigned Identity within the Settings section of the App Service, then given the service the role