Posts

Showing posts from November, 2022

Protect a ASP.NET Core web API with the Microsoft identity platform - Azure AD - Microsoft Entra

{tocify} $title={Table of Contents} In this quickstart, you download an ASP.NET Core web API code sample and review the way it restricts resource access to authorized accounts only. The sample supports authorization of personal Microsoft accounts and accounts in any Azure Active Directory (Azure AD) organization.  Prerequisites Azure account with an active subscription. Create an account for free. Azure Active Directory tenant .NET Core SDK 3.1+ Visual Studio 2019 or Visual Studio Code Step 1: Register the application First, register the web API in your Azure AD tenant and add a scope by following these steps: Sign in to the Azure portal. If you have access to multiple tenants, use the Directories + subscriptions filter  in the top menu to switch to the tenant in which you want to register the application. Search for and select Azure Active Directory. Under Manage, select App registrations > New registration. For Name, enter a name for your application. For example, enter AspNetCore

Create a .NET console application using Visual Studio Code | Dotnet 6 console app sample using VSCode

Image
{tocify} $title={Table of Contents} Tutorial: Create a .NET console application using Visual Studio Code This tutorial shows how to create and run a .NET console application by using Visual Studio Code and the .NET CLI. Project tasks, such as creating, compiling, and running a project are done by using the .NET CLI. You can follow this tutorial with a different code editor and run commands in a terminal if you prefer. Prerequisites Visual Studio Code with the C# extension installed. For information about how to install extensions on Visual Studio Code, see VS Code Extension Marketplace . The .NET 6 SDK . Create the app Create a .NET console app project named “HelloWorld”. Start Visual Studio Code. Select File > Open Folder ( File > Open… on macOS) from the main menu. In the Open Folder dialog, create a HelloWorld folder and select it. Then click Select Folder ( Open on macOS). The folder name becomes the project name and the namespace name by default. You’ll add code la