Posts

Showing posts from August, 2023

Securing a Web API using Azure AD and Consuming it with Swagger - Step by Step Guide

Image
 Introduction: we will walk you through the process of securing a Web API using Azure AD (Azure Active Directory) and generating tokens through Swagger to call this protected API. Securing your APIs is crucial to protect sensitive data and ensure only authorized applications can access them. We'll break down the process into easy-to-follow steps. Prerequisites: Before we begin, make sure you have the following prerequisites in place: An Azure account with the necessary permissions. Visual Studio or a similar code editor. Basic knowledge of .NET Core and Swagger. Github Repository:  Secure the Web API using Azure AD Steps to Secure the Web API using Azure AD: Step 1: Create Two App Registrations We need to create two Azure AD App Registrations, one for the Web API and the other for the Swagger client application. Create a new App Registration named "EmployeeWebApi." Leave the Redirect URI empty. Create a new App Registration named "EmployeeClientApp." Click ...

How to assign management plan role/ control plan role using arm template

Image
 How to assign management plan role/ control plan role using arm template: Description:  In this below example, I am trying assign the "Cosmos DB Account Reader Role (Built-in role) " to  azure ad group.  Parameters:  principalId: your azure ad group/user/application id CosmosDbAccountName: your comsos account name ARM Template Script: {         "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",         "contentVersion": "1.0.0.0",         "parameters": {             "principalId": {                 "type": "string",                 "defaultValue": "",                 "metadata": {                     "description": ""             ...