Tuesday, 10 March 2026

Push Docker Image to Create Azure Container App

Push Docker Image either to Azure Container Registry (ACR), or you can directly upload Public Image of Docker Hub

Step 1: Create Azure Container App

  1. In Azure Portal → Create a Resource → Container Apps.
  2. Fill in: Name, Resource Group, Region
  3. Environment: Create or select an existing one
  4. Under Container, select Single container → Azure Container Registry/Docker Image.
  5. Choose your registry, repository, and tag (e.g., latest).
  6. Set CPU/Memory limits (e.g., 0.5 CPU, 1 GB RAM).
  7. Configure Ingress:
  8. Enable External if you want public access.
  9. Set port (e.g., 8000) to match your Dockerfile.
  10. Review + Create

You can change the same settings in the ingress as well.



You can update your image type and select "Image and Tag" and specify your image here.

















You can update your variable under the container.













Click on the overview you can find the application URL








Monday, 9 March 2026

404 when you refresh React Page on Static Web App

This happens because React uses client-side routing, while Azure Static Web Apps serves static files. When you refresh /login, Azure tries to find a physical /login file, which doesn’t exist, so it returns 404.

This is common with apps using React Router.


Step 1: Add a staticwebapp.config.json file to your project

You need to tell Azure to redirect all routes to index.html so React can handle routing.

Create this file in your build output folder or project root:

staticwebapp.config.json

Step 2: Add this configuration


{
  "navigationFallback": {
    "rewrite": "/index.html",
    "exclude": ["/images/*", "/css/*", "/js/*", "/assets/*"]
  }
}

or 

{
  "navigationFallback": {
    "rewrite": "/index.html"
  }
}

Then rebuild and deploy again.

swa deploy ./dist --deployment-token YourTokenHere --env production

After Deployment

Now these will work on refresh:

/login

/dashboard

/profile

/settings

Deploy Angular/React Application to Azure Static Web App from Visual Studio Code

Step 1: Build your React project

Open the terminal in VS Code and run:

npm install
npm run build

Step 2: Get Deployment Token

  • Go to Microsoft Azure Portal.
  • Open your Azure Static Web App
  • Click Deployment Token
  • Copy the token

Step 3: Install Azure Static Web Apps CLI

Install the CLI tool:

npm install -g @azure/static-web-apps-cli

This installs SWA CLI.

Step 3: Deploy the build folder

Run this command inside your project folder.

swa deploy ./dist --deployment-token ABC123XYZ

Your URL changed because the deployment was created as a preview environment instead of production.

 If you want to deploy on a real URL, then run the command.

swa deploy ./dist --deployment-token TokenHere --env production

Your site will be available at:

https://your-app-name.azurestaticapps.net

Wednesday, 31 December 2025

Azure Function - In-process model vs Isolated worker model

 In-process model

  • Your function code runs inside the same process as the Azure Functions runtime
  • Uses the WebJobs SDK.

[FunctionName("TimetriggerFunction")]

What this means

  • Used in:

    • Azure Functions v1–v4 (in-process)

  • Namespace: Microsoft.Azure.WebJobs

  • Runs inside the same process as the Azure Functions runtime

  • Uses:

    • ILogger for logging

    • TimerInfo from Microsoft.Azure.WebJobs

Characteristics

  • Tight coupling to the Functions runtime

  • Faster startup (historically)

  • More magic / implicit behavior

  • Not recommended for new apps going forward


2. Isolated worker model

  • Your function runs in a separate .NET process from the Azure Functions runtime.
  • Communicates with the runtime over gRPC.

[Function("TimetriggerFunction")]

What this means

  • Used in:

    • Azure Functions v4+ isolated worker

  • Namespace: Microsoft.Azure.Functions.Worker

  • Runs in a separate .NET process from the runtime

  • Uses:

    • FunctionContext instead of ILogger

    • Logging via context.GetLogger(...)


Characteristics

  • Decoupled from the Functions runtime

  • Better:

    • Dependency injection

    • Versioning control

    • Middleware support

  • Required for:

    • .NET 8

    • Future Azure Functions development

Key Differences at a Glance

Feature

[FunctionName]

[Function]

Hosting model

In-process

Isolated worker

Runtime coupling

Tight

Loose

Logging

ILogger

FunctionContext

Namespace

WebJobs

Functions.Worker

.NET 8 support

No

Yes

Recommended for new apps

No

Yes


Summary

In-process = older, tightly coupled, simpler
Isolated worker = modern, decoupled, flexible, future-proof

Wednesday, 2 July 2025

How to get PowerBI Embed Token

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

Step 1: Register Your App in Azure

  • 1. Go to Azure Portal → App registrations
  • 2. Register a new app.
  • 3. Provide necessary API permissions
  • 4. Go to Certificates & secrets → Generate a Client Secret






 




Step 2: Assign the App to the Power BI Workspace

1. Go to Power BI Service
2. Click Workspace access
3. Add the App's Service Principal(App Registration ClientId) as an Admin or Member














Step 3: 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://analysis.windows.net/powerbi/api/.default
















Endpoint will provide you with an Access Token












Step 4: Generate the Embed Token


URL: Post Endpoint 

https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/GenerateToken


Headers

Authorization: Bearer <access_token>
Content-Type: application/json

Body

{
  "accessLevel": "View"
}









 

Sample Code to embed the PowerBI Report in an HTML Page



<script src="https://cdn.jsdelivr.net/npm/powerbi-client@2.21.1/dist/powerbi.min.js"></script>

<style>
    #reportContainer {
      width: 100%;
      height: 800px;
      border: 1px solid #ccc;
    }
  </style>

<div id="reportContainer"></div>

<script>
  
    const embedToken = "Call the APIs and pass the token here";
    
    const embedUrl = "https://app.powerbi.com/reportEmbed?reportId=report id here&groupId=group id here";

    const reportId = "your report Id here";

    // Embed configuration
    const config = {
        type: 'report',
        id: reportId,
        embedUrl: embedUrl,
        accessToken: embedToken,
        tokenType: window['powerbi-client'].models.TokenType.Embed,
        settings: {
            filterPaneEnabled: false,
            navContentPaneEnabled: true
        }
    };

    const reportContainer = document.getElementById('reportContainer');

    // Embed the report
    const powerbi = new window['powerbi-client'].service.Service(
        window['powerbi-client'].factories.hpmFactory,
        window['powerbi-client'].factories.wpmpFactory,
        window['powerbi-client'].factories.routerFactory
    );

    powerbi.embed(reportContainer, config);
</script>


Power BI - PowerBIEntityNotFound Error in Embed Report

Typically, PowerBIEntityNotFound indicates that the requested resource (report, dataset, or workspace) could not be found under the access token's permissions. 



{
    "error": {
        "code": "PowerBIEntityNotFound",
        "pbi.error": {
            "code": "PowerBIEntityNotFound",
            "parameters": {},
            "details": [],
            "exceptionCulprit": 1
        }
    }
}


You need to check a couple of things.

1. Ensure the workspace GUID is accurate. 


You can find it in the URL when viewing a report:
https://app.powerbi.com/groups/{workspace-id}/reports/{report-id}

2. Is the Report ID correct?

    same steps as above.

3. Does the service principal have access?

Your Azure AD app (service principal) must be added to the workspace as a member or admin:

Go to Power BI Service → Workspace → Access
















Add the service principal (client ID) as a Member or Admin

























4. Ensure service principal access is enabled in tenant settings


In Power BI Admin Portal: Go to Tenant settings

Enable:
"Allow service principals to use Power BI APIs"
"Allow service principals to create embed tokens."

5. Ensure you are using the correct scope and authority in the token request.

SCOPE = "https://analysis.windows.net/powerbi/api/.default"

Check all the above steps, and it will resolve the issue.

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.

 

 

Push Docker Image to Create Azure Container App

Push Docker Image either to Azure Container Registry (ACR), or you can directly upload Public Image of Docker Hub Step 1: Create Azure Conta...