Skip to content

realxwx/ms-identity-easyauth-dotnet-storage-graphapi

 
 

Repository files navigation

languages page_type description products
csharp
powershell
html
sample
Learn how to sign-in users to your web app, call Azure storage, and call Microsoft Graph.
azure
azure-active-directory
dotnet
azure-storage
aspnet
ms-graph

Tutorial: enable authentication in App Service, access storage, and call Microsoft Graph

A set of ASP.NET Core sample apps and tutorial that demonstrate how you can:

  • (A) Configure authentication for a web app running on Azure App Service and limit access to users in your organization​.
  • (B) Securely access Azure storage on behalf of the web application using managed identities​.
  • (C) Access data in Microsoft Graph on behalf of the signed-in user​, or
  • (C) Access data in Microsoft Graph on behalf of the web application using managed identities​.

Web app accesses storage and Microsoft Graph

Deploying a web app to Azure and configuring authentication is a pre-requisite to the other steps. Accessing Azure storage using managed identities, accessing Microsoft Graph using managed identities, and accessing Microsoft Graph as the user are independent steps and can be done in any order.

These sample apps back the Tutorial: enable authentication in App Service and access storage and Microsoft Graph articles on docs.microsoft.com.

Configure authentication for a web app and limit access to users in your organization

If you are a Line of Business (LOB) developer, you'd probably want to only sign-in users in your organization with their work or school accounts. In this step, you learn how to enable the Azure App Service authentication/authorization module in Azure App Service, so you can sign in users and access data by writing minimal or no code in your web app. This step is required and is done inline with the other steps. Read Add authentication to your web app running on Azure App Service for more information.

Securely access Azure storage on behalf of the web application using managed identities​

In this step, you configure authentication for a web app and access Azure blob storage as the web app (using managed identities).

You learn how to:

  • Setup authentication for your web app.
  • Display a "Hello user X" message using the Microsoft.Identity.Web library.
  • Create a system-assigned managed identity on a web app.
  • Access storage from a web app (on behalf of the app) by using managed identities

Access data in Microsoft Graph on behalf of the signed-in user​

In this step, you configure authentication for a web app and call Microsoft Graph from a secured app on behalf of the signed-in user.

You learn how to:

  • Setup authentication for your web app.
  • Display a "Hello user X" message using the Microsoft.Identity.Web library.
  • Grant delegated permissions to a web app.
  • Call Microsoft Graph from a web app on behalf of the signed-in user.

Access data in Microsoft Graph on behalf of the web application using managed identities​

In this step, you configure authentication for a web app and call Microsoft Graph as the web app (using managed identities)

You learn how to:

  • Setup authentication for your web app.
  • Display a "Hello user X" message using the Microsoft.Identity.Web library.
  • Create a system-assigned managed identity on a web app.
  • Add Microsoft Graph API permissions to a managed identity.
  • Call Microsoft Graph from a web app (on behalf of the app) by using managed identities.

Getting Started

Prerequisites

To run this sample, you'll need:

Installation

Clone or download this repository. From your shell or command line:

git clone https://github.com/Azure-Samples/ms-identity-easyauth-dotnet-storage-graphapi.git

Community Help and Support

Use Stack Overflow with the community to provide support, using the tags web app, asp.net core. We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.

If you find and bug in the sample, please raise the issue on GitHub Issues.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Documentation

Tutorial: enable authentication in App Service and access storage and Microsoft Graph articles on docs.microsoft.com.

About

ms-identity-easyauth-dotnet-storage-graphapi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 56.4%
  • HTML 34.7%
  • CSS 7.6%
  • JavaScript 1.3%