Error when trying to consent Azure VPN application - azure

I am trying to setup a p2s VPN using Azure Active Directory authentication. I am following the steps described here https://learn.microsoft.com/en-us/azure/vpn-gateway/openvpn-azure-ad-tenant. In the section Authorize the application, it's mentioned that we need to grant admin consent, so that Azure VPN application can sign in and read user profiles. I am logged in as GlobalAdmin, but when I paste the required URL (https://login.microsoftonline.com/common/oauth2/authorize?client_id=41b23e61-6c1e-4545-b367-cd054e0ed4b4&response_type=code&redirect_uri=https://portal.azure.com&nonce=1234&prompt=admin_consent) I am redirected to the portal with url:
https://portal.azure.com/?error=access_denied&error_description=AADSTS650054:+The+application+'api://41b23e61-6c1e-4545-b367-cd054e0ed4b4/api'+asked+for+permissions+to+access+a+resource+that+has+been+removed+or+is+no+longer+available.+Contact+the+app+vendor.
What am I doing incorrectly ?

The above behavior was a code bug which was fixed by the Azure VPN and Azure AD Product Groups team and below is the RCA (Root Cause Analysis) for same:
Issue: When setting up a P2S VPN using Azure Active Directory authentication following the steps described in our public doc tutorial and trying to grant admin consent to the Azure VPN application using GlobalAdmin account, the public URL redirects to "https://portal.azure.com/?error=access_denied&error_description=AADSTS650054:+The+application+'api://41b23e61-6c1e-4545-b367-cd054e0ed4b4/api'+asked+for+permissions+to+access+a+resource+that+has+been+removed+or+is+no+longer+available.+Contact+the+app+vendor" and doesn't give the prompt to accept the requested permissions.
Root Cause:
Admin Consent was failing for new customers as Azure VPN was trying to get access to Azure AD Graph and this is deprecated.
Refer : https://learn.microsoft.com/en-us/graph/migrate-azure-ad-graph-configure-permissions?tabs=http%2Cupdatepermissions-azureadgraph-powershell
This impacted only new Tenants who want to onboard to VPN and not existing customers. Some code was updated in the backend which broke the admin consent flow. The app access has been changed to Microsoft Graph now and the newly added code was removed from the Azure VPN client app from the backend which has fixed the issue.
Solution:
Now if you follow the documentation/guide Configure Azure AD tenant and settings for P2S VPN connections: Azure AD authentication: OpenVPN - Azure VPN Gateway | Microsoft Learn, the public URL at Step 2 should work without any issues.

Related

Provide App service security in Azure solutions

I have a click once windows application which already has authentication n Authorization built in. Earlier i used to deploy it on physical server n share the location with users so that they can install it n use it. But now we have decided to deploy it on azure PAAS service (App service ). But currently url is geting access by anyone which i want to restrict. Currently my organization AD is not synced with Azure AD. So not able to use Azure AD for authentication.
Kindly provide some better solutions other than restricting users based on IP.
If it's a file download you can put it on Azure Blob storage for download and generate short-time SAS tokens.
While IP address restrictions and Azure AD authentication would be one-efficient approach for your scenario. Since you do not want to go that route (due to environment limitations), If you wish you could authenticate users with the specified provider (Microsoft Account, Facebook, Google, Twitter or Any OpenID Connect provider). App Service provides built-in authentication and authorization support, so you can sign in users and access data by writing minimal or no code.
App Service uses federated identity, in which a third-party identity provider manages the user identities and authentication flow for you. You can also use multiple sign-in providers.
So the simple process could be:
The option is Log in with . App Service redirects all anonymous requests to /.auth/login/<provider> for the provider you choose. If the anonymous request comes from a native mobile app, the returned response is an HTTP 401 Unauthorized.
Kindly checkout step-step instructions on the process/workflow:
Configure your App Service or Azure Functions app to use Microsoft Account login
If your WebApp is on VNet, you can have service endpoints enabled for Microsoft.Web, through access restrictions.
See- Advanced usage of authentication and authorization in Azure App Service

Does Azure Bastion with AAD Credentials

I recently created a Azure Bastion service and Azure VM in my organisation's Subscription. When I try to connect to the VM via the Bastion using local Admin ID it worked. However the same is failing when I try with my Azure AD ID. Is this a limitation?
There are two (2) authentication schemes:
Azure Active Directory (AAD) authentication: Azure Bastion does not currently support authentication using AAD-based (cloud) users. This request is known and prioritized as "high" by the product team. See this [link][1] for details in user voice. The advantage of this approach is to provide full cloud-based authentication, with no dependency on on-premises technology (in this case, Active Directory). One workaround for now is to expose a jumpoint on a vNet until availability of this feature.
Azure Directory (AD) authentication: Azure Bastion does currently support authentication using AD-based users (Windows AD User). Since this is a managed "Active Directory" provided by Microsoft, the use of Azure AD Connect is needed to sync this domain (and users) to Azure Active Directory (AAD). The drawback of this approach is to continue building using on-premises technology (Active Directory).
Public preview announced during Microsoft Ignite 2021 to include support for Azure AD login for Bastion enabled VMs. It is available using Azure CLI client on Windows and leveraging native client (openSSH to do Azure AD based SSH for Linux and mstsc to do Azure AD based RDP for Windows). Details can be found at https://learn.microsoft.com/en-us/azure/bastion/connect-native-client-windows

IIS Windows Authentication using Federated Identities in Azure AD

I am trying to make Windows Authentication (with Kerberos/NTLM) work in a Web App hosted in IIS using Azure AD Federated users but seems it does not work. Below are the whole infrastructure details:
I have an Azure AD (e.g. skj.onmicrosoft.com) with Azure AD Domain Services Configured
I have an on premises Windows AD (e.g. skjtest.com) which is federated with the Azure AD. The on-prem users are available in AAD, SSO works but the password hash is not synced with AAD.
A VM is created in Azure and joined to the AAD Domain skj.onmicrosoft.com
I created a Web App which uses Windows Authentication and hosted in IIS present in the above Azure VM
When I try to login using an AAD user (e.g. aaduser1#skj.onmicrosoft.com) to the web app, it works all fine using both Kerberos and NTLM
However when I try to login using a federated identity (e.g. feduser1#skjtest.com), it fails showing a 401 Unauthorized Status code.
Here my question is, is this at all possible to make the Windows Auth (with Kerberos or NTLM) work with the Federated identities? If yes, please let me know the ways I can achieve this.

Azure App Services trusted connection to SQL Azure

I have a web application hosted in Azure App Services (allowing anonymous access) that I need to connect to a SQL Azure DB through a TRUSTED CONNECTION. My business will not allow me to store a password in the web.config (hence the "trusted connection" requirement). Can someone please point me in the right direction?
UPDATE:
We are using Azure AD. I have looked into running the app under an AD account (can't figure out how to do this). I have also tried to find what account the app is running under so I can add that to the DB (can't figure this out either)
Active Directory IS the answer you're looking for- you'll want to do Token Authentication.
The short explanation is that your application needs to be registered with Azure Active Directory (AAD), and that you need to create a SQL login for the application that maps to the AAD principal; the application using the token (certificate) is able to authenticate as the AAD principal and will be able to connect to the database.
We created a tutorial that covers the ability to connect without putting a password in your config- you'll need to use a certificate. This demo covers how to do it with a self-signed/self-created cert.

How to integrate On-Premweb application with Web app hosted on Azure (AAD authentication)?

What could be the ways to integrate a web application ( on-prem) to another web application (Azure) using azure AD authentication( happening in the background), with out the user being prompted for credentials.
It depends on how your on-premise application authenticated. Based on the description, you want to implement the single sign-on for the on-premise application with the application which protected by Azure AD.
In this scenario, you can deploy ADFS on-premise and make the on-premise web application authenticate by the ADFS. Then we need to enable the trust from the ADFS to Azure AD. After build the federated trust, when the users try to access the web application which protect by Azure AD will redirect to the ADFS, and if the users already authenticate the on-premise application they will not required to enter their credential again. Here is a figure to demonstrate this progress and you can refer more detail about it from this link.
And now, we can use Azure AD connect to integrate your on-premises directories with Azure Active Directory easily. You can refer the video on this link about different settings for this tool.

Resources