HTTP Error 500.30 - ANCM In-Process Start Failure when using azure keyvault - azure-keyvault

I am using GitHub Action for CI/CD to Azure web app in .NET core 3.1 MVC. I am able to get the secrets from Azure key vault in localhost but when I browse the app hosted in azure portal (xyz.azurewebsites.net), I get HTTP Error 500.30 - ANCM In-Process Start Failure.
I have given permission to Key Vault to App from Access Policies with GET and LIST
My program.cs file is as below

Related

access azure key vault from azure web app where ip changes often bc of CI/CD

I have a docker container that accesses azure key vault. this works when I run it locally.
I set up an azure web app to host my container, and it cannot access the key vault
Forbidden (HTTP 403). Failed to complete operation. Message:
Client address is not authorized and caller is not a trusted service.
Client address: 51.142.174.224 Caller:
I followed the suggestion from https://www.youtube.com/watch?v=QIXbyInGXd8 and
I went to the web app in the portal to set status to on
Created an access policy
and then receive the same error with a different ip
Forbidden (HTTP 403). Failed to complete operation. Message:
Client address is not authorized and caller is not a trusted service.
Client address: 4.234.201.129 Caller:
My web app ip address would change every time an update were made, so are there any suggestions how to overcome this?
It might depend on your exact use case and what you want to achieve with your tests, but you could consider using a test double instead of the real Azure Key Vault while running your app locally or on CI.
If you are interested please feel free to check out Lowkey Vault.
I found solution by setting up a virtual network,
and then whitelisting it in the keyvault access rights

SignalR Azure Active Directory authorization issue

I have an app that is hosted under the azure app service. The app builds on ASP.NET MVC with Angular JS (SPA).
The hosted app is protected with Azure Active Directory authentication. And afterward, I integrated SignalR (2.0.4) into the same application.
SignalR is working correctly on the same site, but when trying to connect the SignalR hub connection from another app it just breaks and redirects me to the MS login page, as a web app service protected with required Azure Active Directory authentication.
I did try to send Authorization: "Bearer <token>" and X-MS-TOKEN-AAD-ACCESS-TOKEN in the request header but it did not work.
My SPA (AngularJs) and SignalR code are in the same project.

What is the on-premise equivalent of an Azure key vault?

As I am a programmer with solely experience with production environments in the cloud that run with a cloud-based secret manager, I was wondering: How are secrets managed in an on-premise instance? I bet they are not just written in the application settings or the OS environment variables?
• There is no equivalent of azure key vault in on premises environment though you can use ADCS (Active directory certificate services) for certificate shared secret management in on premises infrastructure for authorizing and authenticating resources, service principal names and other identity attributes.
• Though for the handling of the cryptographic keys used by the cloud apps and services hosted on premises, we can setup app key vaults for business central on-premises server as well. Please refer the below official documentation for your reference: -
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/setup-app-key-vault-onprem
This document articulates the steps and processes to undertake for integrating the functionality of Azure key vault in your on-premises environment.
• Though, if you want to directly use the Azure key vault’s functionality in your on-premises infrastructure environment, you can provide internet access to your on-premises resources and use client certificate authentication and IP restrictions with key vault through a VPN tunnel for additional security.
Please refer the below links for more information: -
secret management in on premise application

Obtain OAuth token using Service Connection

I'm using Azure DevOps to deploy a web app and perform database migrations for an SQL Database. I have a Service Connection setup, and am able to deploy Azure resources using the Azure CLI, e.g.
- task: AzureCLI#2
displayName: 'Deploy Azure resources'
inputs:
azureSubscription: 'My Service Connection'
scriptType: 'bash'
scriptLocation: inlineScript
inlineScript: ./deploy.sh
Now, I want to perform database migrations, and I want to use the Service Connection to authenticate (the App Registration has been granted access to the SQL Database). My understanding is that I can login to the SQL Database using an OAuth token - my problem is how to get that token using the Service Connection.
Note that I can't add a client secret to the Service Principal in Azure, and so can't make a REST call to /oauth2/token with a client_secret (I work in the enterprise space, and things are locked down).
Given the pipeline has access to the Azure DevOps Service Connection, my feeling is there must be some way to use it to get an OAuth token that's valid for the https://database.windows.net/ resource - but how?
You may try the solution in the following case: Azure Pipeline connect to SQL DB using service principal
Adding an Azure CLI task which retrieved the bearer token. Then passed
this to Azure Powershell task which used the token.
$token= & az account get-access-token --resource=https://database.windows.net --query accessToken
Write-Host("##vso[task.setvariable variable=sqlToken]$token")

Cloud service ERR_CONNECTION_TIMED_OUT

I am working with azure cloud service.
I tried to deploy simple web role to azure as cloud service. My web role just a simple asp net mvc app which convert html to pdf(I am using hiqpdf for conversion) without connection to db.
My web role deployed successfully, Virtual Machine was created and i can access my site through rdp on local iis of VM.
But i cannot access site through public url(my.cloudapp.net) b/c of error: ERR_CONNECTION_TIMED_OUT.

Resources