I'm trying to restrict access to my Azure webapp to a specific User group - azure

My On-prem AD is in sync with Azure AD and Im trying to give access to my Azure hosted website (Webapp) to a specific set of user(AD groups) via seamless login
I alredy tried setting different option avail in App registration but none of them worked as expected

Open the App which registered in your Azure AD, click Managed application in local directory> Properties> User assignment required to Yes.
When this option is set to Yes, users must first be assigned to this application before they can access it. Then assign users and groups to the app.
For more details, you could refer to this article.

Related

Assigning specific app service access to Azure active directory user

I have created one Active Directory user in Azure portal, now I want to allow this user to access only one app service (Start/Stop/Change settings etc.), I am not able to figure out how to do so.
You could use role-based access control (RBAC) to do it.
Make sure the user is in the subscription, navigate to the app service in the portal -> Access control (IAM)-> Add.

Azure: Create user that can log into a web app but not the azure portal

I've deployed an asp.net web forms application to an app service resource. I've turned on the app service authentication and set it to Log in With Azure Active Directory.
I've created a guest user account and verified that the user can log in to my application. That user is also able to log into the azure portal, and although the user doesn't appear to be able to do anything in the portal, they can still get to the portal and see things. How can I create users that can access my app service but not the azure itself. And if I have multiple app services, how can I create users that are silo'd to specific app services?
There is no way to prevent a user which has been your directory to sign in Azure portal. Onece you invited the user to your directory, the user could also login azure portal. But I also want to make clear that the user can not do anything in your directory and Azure resources if you don't give him/her permissions.
And if I have multiple app services, how can I create users that are
silo'd to specific app services?
Well, this can be resolved. Since each Web App liknes to one service principal, you need to set User assignment required to be Yes in the Properties for that service principal and only assigned users (Add users in Users and groups) can access to login access to this app.

Azure - restrict access to app service only

Ive created a website in Azure and I want to allow users to login and use the app, but im slightly confused by azure active directory access. I want users to only have acces to the web app, not to the portal. Users will be from within my organisation and from outside it so its vitally important that access is locked down, If a user somehow ends up at the azure portal they must not be able to access it. If I set users up in our active directory, wont they be able to login to the azure portal too ? I want to take advantage of authentication as a service and hand over authentication and multi factor authentication to azure but everytjhing Ive read so far seems to suggest If i use azure active directory, users will be able to acess the Azure portal too, is this correct or am i misinterpreting the information ? Are there any step by step guides available for these sorts of scenarios ?
If i use azure active directory, users will be able to acess the Azure
portal too, is this correct or am i misinterpreting the information ?
No, your users will not have access to Azure Portal (rather Azure Subscription as Azure Portal is an application using which a user manages one or more Azure Subscriptions) unless you grant them permission to access it. In order for your users to have access to Azure Portal, you would need to grant them permissions explicitly to do so. In the new portal, you do it by assigning roles (e.g. Owner, Contributor, Reader etc.) and in the old portal you do it by making them co-administrators.
Unless you do this, when they login into Azure Portal all they will see is a message stating no Azure Subscriptions were found.

Unable to enable Organizational Authorization for custom domain in O365 Azure AD

I want to publish a web application to a Azure Web App and enable Organizational Authentication during the process. The wizard offers the following options:
I've added two custom domains to our Office 365 subscription that also show up in the corresponding Azure AD tenant.
Instead of using the default domain mycompany.onmicrosoft.com I want to use one of those custom domains so that this domain is shown to the user on various web pages that handle authentication and consent. I was able to use the custom domain without any problem when configuring Azure AD authentication for the web project.
When using the custom domain in the wizard (field domain in the screenshot), I first need to enter my O365 credentials. Shortly after, the following error is displayed:
Provisioning the destination end point failed with the error:
'The user account 'x#y.z' doesn't have the required permissions to access the domain 'y.z'.'
If you don't intend to enable Orgnizational Authentication during
publish, please turn that option off in the publish dialog.
The Directory Role of the account is Global Administrator and I've already registered multiple apps using this account. So I don't think that this has anything to do with permissions.
Do I have to use the *.onmicrosoft.com domain or can I solve this in a different way?
As a sidenote (just if this is makes a difference): the web app resides in a Azure subscription that belongs to my Microsoft account whereas the O365 Azure AD is administered by my work account and does not belong to a subscription. Of course, not the most straightforward way, but I guess pretty common for Microsoft partners as the Azure benefits can only be actived on a Microsoft account even if the partner already has a O365 subscription.
To use the custom domain for the organization authentication we need to enable it as the primary domain.
You can check it from the old Azure portal here like figure below:
Update( change the primary domain in new Azure portal)
locate Azure Active Directory->Domain names->select the domain which want to set as primary domain like figure below:

How can I programmatically retrieve the domain name of the Azure Active Directory in a given subscription?

I'm working on an application that will allow users to authenticate to Azure Active Directory and then manage resources in their Azure account via Azure Resource Manager API calls.
I've found several walkthroughs on building such an app including this post. However, in the part that discusses authentication with Azure Active Directory, there's a step showing the need to manually retrieve the Azure Active Directory name from the Azure Portal.
The directory name is plugged into app settings (and ultimately authentication calls to the directory) as follows
http://login.microsoftonline.com/{directory_domain_name}/OAuth2/Authorize
Is there any way to programmatically retrieve {directory_domain_name} without requiring users to login and lookup the information in the Azure Portal?
The one answer to this question has a dead link and another pointing to the Graph API, which seems to still require the domain name.
For your particular scenario, look like you want to build an app that will be users from different Azure AD tenants. This scenario is best addressed by building a multi-tenant application.
To make your application multi-tenant, you'll need to go to the Azure Portal and in the Configure tab of your Azure AD application, set the "Application is Mult-Tenant" option to yes.
Once you do this, you can just call
http://login.microsoftonline.com/common/oauth/authorize
http://login.microsoftonline.com/common/oauth/token
And Azure AD will resolve the figure out which tenant to authenticate against based on the the credential that the user types in.
More information on multi-tenant applications:https://azure.microsoft.com/en-us/documentation/articles/guidance-multitenant-identity-authenticate/
Sample multi-tenant application: https://github.com/Azure-Samples/active-directory-dotnet-webapp-multitenant-openidconnect

Resources