Showing posts with label Azure. Show all posts
Showing posts with label Azure. Show all posts

Wednesday, 25 June 2025

Create an Azure AD B2C (ADB2C) user using Postman

 Here's a step-by-step guide to help you through the process.

Registered App in Azure AD B2C with:

  • Delegated Microsoft Graph API permissions:
    • User.ReadWrite.All
    • Directory.ReadWrite.All
  • Client secret
  • Admin Consent granted for permissions







 



Step 1: Get Access Token 

Request:

 Method: POST
 URL: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

 

Headers:
Content-Type: application/x-www-form-urlencoded 

Body: (x-www-form-urlencoded):

grant_type=client_credentials

client_id={your-client-id}

client_secret={your-client-secret}

scope=https://graph.microsoft.com/.default


















Endpoint will provide you with an Access Token












Step 2: Create a User

Request:

Method: POST
URL: https://graph.microsoft.com/v1.0/users

 

Headers:

Authorization: Bearer {access_token}

Content-Type: application/json

 

Body (raw JSON):

{  
  "displayName": "sunny setia",
  "givenName": "sunny27",
  "surname": "setia",
  "identities": [  
    {  
      "signInType": "emailAddress",  
      "issuer": "tssorg.onmicrosoft.com",  
      "issuerAssignedId": "setia27@mailinator.com"  
    }
  ],  
  "passwordProfile":{  
    "password": "P@ssword1",  
    "forceChangePasswordNextSignIn": false  
  },  
  "passwordPolicies": "DisablePasswordExpiration"  
}  















Important:

  • The Issuer must follow your B2C tenant domain.
  • Use a strong password that meets AAD complexity requirements.

 

 

Tuesday, 4 May 2021

Create Azure Key Vault and Access in Asp.Net Core Application

Azure Key Vault is a cloud service that helps teams securely store connection string, passwords, etc, and access them. Today in the article we will learn how to create the Key Vault in Azure Portal and how to access secrets in our code. 


Step 1: Go to Azure Portal and search Key Vault and create it. 



 





Step 2: Enter Key Vault Name, Resource Group, Region, etc as mentioned the below screenshot.

Press Review + Create button. 


Step 3: It will check validation in the background and it will create a new Key Vault. 


Step 4: Click on Your Key Vault and go to Secrets and Press Generate/Import button.



 






Step 5: Create a new secret with any name. I have created a new secret dbpwd. Press Create button.



 







Till now, we have created the Key Vault in the Azure Portal and created the secret too. Let’s fetch this secret value in the Code. Let’s create a sample in Asp.Net Core API application and fetch the secret.


Create/Open Visual Studio Web/API application. In my example, I have created Asp.Net Core 3.1 Application.


 Step 1: Go to Program.cs, In line number 35, I have specified my Key Vault URL. You can specify your Key Vault URL. if you are not aware of your URL then go to Azure Portal and click on the Key Vault and see in the Overview Tab. You can find the URL.

 


Note: I have used default credentials in line 27. I have logged in to Visual studio with the same credentials as I'm logged in on the Azure portal.


Step 2: Go to Controller and fetch Key Vault Secret.













I have created a new endpoint, kV, and fetch the secret value.


Step 3: Run the API Project



 





You can see it fetched the secret value in the browser. This is all about this article. I hope you like it.





Tuesday, 30 March 2021

Connect your Azure App Service to Custom Domain


In this article, we will learn how we can add a custom domain to our website. I hope you are already aware of how to publish the website to Azure. Once you publish the website on azure you will get a URL like xxx.azurewebsites.net. Now you want your domain name let’s say www.abc.com to open the website xxx.azurewebsites.net that is hosted on Azure.


Step 1: Ensure your website is published on a minimum B1 Plan because the Custom Domain feature is not available on Free Plan (F1)









Step 2: Go to App Services -> Custom Domains, Click on it.
























Step 3: Click on Add Custom Domain Button

Step 4: Enter your custom domain e.g. (www.abc.com) and click validate button.              















Step 5: It will ask you to select either A record or CNAME. You can choose any one option. You need to prove the domain ownership. In this article, we will use A record.









Step 6: Select A record and scroll down, it will display Type txt and A value. We need to enter these values into our domain provider DNS Settings.























Step 7: Open the website of your domain provider. Let’s say you have purchased the domain from GoDaddy or BigRock. Open their website and go to My Products.


Step 8: Click on your domain and go to the DNS section.
















Step 9: Update A Type and Txt Value here.




















Wait for 10-15 mins and you can see your website is up and running.

Now when you will open abc.com it will open the same website that is deployed to Azure. This is all about this article. I hope you like it.




Create an Azure AD B2C (ADB2C) user using Postman

 Here's a step-by-step guide to help you through the process. Registered App in Azure AD B2C with: Delegated Microsoft Graph API...