Thursday, May 7, 2026

Microsoft Power Pages & Portals Complete Guide

Microsoft Power Pages & Portals — Complete Guide

Power Pages Architecture · Liquid Templates · Web Roles · Authentication · Dataverse Integration · ALM · Scenarios · Cheat Sheet


Table of Contents

  1. Core Concepts — Basics
  2. Architecture & Components
  3. Authentication & Web Roles
  4. Liquid Templates & Customisation
  5. Dataverse Integration & Forms
  6. ALM, Security & Performance
  7. Scenario-Based Questions
  8. Cheat Sheet — Quick Reference

1. Core Concepts — Basics

What is Microsoft Power Pages and how did it evolve?

Microsoft Power Pages is a low-code platform for building secure, data-driven external-facing websites and portals. It is built on the Power Platform and uses Dataverse as its primary data store.

Evolution:

  • Dynamics 365 Portals (pre-2018): tightly coupled with Dynamics 365
  • Power Apps Portals (2018–2022): rebranded, part of Power Platform
  • Microsoft Power Pages (2022–present): standalone product with a modern design studio, enhanced security, and dedicated site management

What Power Pages enables:

  • External customer portals (case management, self-service)
  • Partner portals (deal registration, partner onboarding)
  • Employee self-service portals (expense claims, HR requests)
  • Community portals (forums, knowledge bases)
  • Government/citizen service portals
  • Event registration and management portals

Key positioning: Power Pages is the "external-facing" complement to model-driven Power Apps (internal). Where model-driven apps serve employees, Power Pages serves customers, partners, and citizens.


What is the difference between Power Pages and Power Apps model-driven apps?

Power Apps Model-Driven Apps:
→ Audience: internal users (employees)
→ Authentication: Entra ID (Azure AD) — requires M365/Azure licence
→ Interface: Unified Interface, Dataverse forms/views
→ Access: direct Dataverse access with security roles
→ Customisation: Power Apps designer, canvas controls
→ Licensing: per user (Power Apps licence)
→ Use for: CRM, ERP, internal workflows

Power Pages:
→ Audience: external users (customers, partners, citizens)
→ Authentication: identity providers (Entra B2B, Azure B2C,
                  Google, Facebook, local accounts, LinkedIn)
→ Interface: custom web pages, HTML/CSS/JS, Liquid templates
→ Access: filtered Dataverse data via table permissions + web roles
→ Customisation: Power Pages design studio, VS Code, Liquid/JS
→ Licensing: per page view or capacity (Power Pages licence)
→ Use for: customer portals, partner portals, citizen services

What are the Power Pages licence models?

Power Pages Authenticated Users:
→ Licensed per authenticated user per month
→ For portals where users must sign in to access content
→ Includes internal and external authenticated users
→ Covers: case submissions, account management, personalised content

Power Pages Anonymous Users (Capacity):
→ Licensed per page view (capacity units)
→ For public-facing portals where content is accessible without login
→ Anonymous users: 100 page views per capacity unit
→ Covers: public websites, event info, knowledge base browsing

Power Pages add-on:
→ Purchased as a standalone capacity add-on
→ Can be pooled across an environment

Included with Dynamics 365 licences:
→ D365 Customer Service Enterprise → 1 Power Pages production capacity
→ D365 Sales Enterprise → 1 Power Pages production capacity

What are the key portal templates available in Power Pages?

Template Use Case
Blank website Start from scratch with full control
Customer self-service Case creation, knowledge base, account management
Community Forums, idea submissions, community discussions
Partner Deal registration, partner onboarding, MDF claims
Employee self-service HR requests, expense claims, internal announcements
Modern Community Updated community template with modern UI
Starter layout 1-5 Pre-built page structures for rapid starts

2. Architecture & Components

What is the Power Pages architecture?

Power Pages Architecture:

External User (Browser)
        ↓ HTTPS
Power Pages Web Application (Azure-hosted)
        ↓
Caching Layer (Azure CDN / Portal Cache)
        ↓
Liquid Template Engine
        ↓
Power Pages Web API / FetchXML
        ↓
Dataverse (entity/table data)
        ↓
Connected Services:
  → Entra ID / Azure AD B2C (authentication)
  → Azure Blob Storage (file attachments)
  → SharePoint (document management)
  → Power Automate (workflow triggers)
  → Azure API Management (external API calls)

Key architectural facts:
→ Power Pages runs as a dedicated Azure Web App per environment
→ Each portal is associated with ONE Dataverse environment
→ Portal metadata (pages, content, web roles) stored in Dataverse tables
→ Content served via Liquid templates + static assets (CSS, JS, images)
→ Changes in Power Pages design studio write to Dataverse metadata tables

What are the core Power Pages components?

Webpages:
→ The URL-addressable pages of the portal
→ Each webpage has: name, partial URL, parent page, web template
→ Hierarchy: Home → About → Services → Contact
→ Published/Draft state: draft pages not visible to portal visitors

Web Templates:
→ Liquid + HTML defining how a page renders
→ Assigned to webpages
→ Can include: HTML, Liquid tags, JavaScript, Bootstrap CSS classes
→ Reusable across multiple pages

Content Snippets:
→ Small reusable pieces of text/HTML
→ Managed separately from page content
→ Used for: site name, footer text, error messages, shared labels
→ Editable by portal admins without editing the web template

Entity (Table) Forms:
→ Dataverse forms surfaced on the portal
→ Create, edit, or read-only modes
→ Linked to Dataverse table + form definition
→ Control: which columns visible, required fields, validation

Entity (Table) Lists:
→ Dataverse views surfaced as lists/grids on portal
→ Filter, sort, and paginate Dataverse records
→ Column display, search, linked forms for detail view
→ Supports: OData feeds, download as Excel/CSV

Web Files:
→ Static assets stored in Dataverse and served by the portal
→ Images, CSS overrides, JavaScript files, PDF downloads
→ Managed via Portal Management app or design studio

Site Settings:
→ Key-value configuration pairs controlling portal behaviour
→ Examples: Authentication/Registration settings, search settings,
            file upload limits, header/footer behaviour
→ Critical settings control authentication providers, email configs

What is the Portal Management app?

The Portal Management app is a model-driven Power App that provides full configuration access to all portal components — webpages, web templates, web roles, table permissions, entity forms, entity lists, site settings, and more.

When to use Portal Management app vs Design Studio:

Design Studio (Power Pages studio):
→ Visual, low-code experience
→ Page layout, sections, components drag-and-drop
→ Form/list configuration
→ Navigation management
→ Theme and styling
→ Best for: makers and page builders

Portal Management App:
→ Full access to all portal metadata tables in Dataverse
→ Advanced configuration not available in design studio
→ Web role and table permission configuration (complex setups)
→ Site settings configuration
→ Web template source code editing
→ Page hierarchy management
→ Authentication provider configuration
→ Best for: advanced developers and administrators

3. Authentication & Web Roles

What authentication providers does Power Pages support?

Supported identity providers:

Microsoft Entra ID:
→ Entra ID (Azure AD) — for employees and internal users
→ Entra External ID (B2B) — for partner organisations
→ Azure AD B2C — for consumer identities with custom flows
→ Protocol: OpenID Connect / OAuth 2.0

Social providers:
→ Microsoft Account (personal)
→ Google
→ Facebook
→ LinkedIn
→ Twitter/X (via custom OAuth)

Enterprise providers:
→ Any SAML 2.0 provider
→ Any OpenID Connect provider
→ WS-Federation

Local authentication:
→ Email/password accounts managed within Power Pages
→ Email confirmation, password reset flows included
→ NOT recommended for production — use federated IdPs

Multi-provider configuration:
→ A single portal can support multiple providers simultaneously
→ User sees options: "Sign in with Google" + "Sign in with Entra ID"
→ Contact matching: link sign-ins from different providers to same Contact record

What are Web Roles and how do they control access?

Web Roles are the primary access control mechanism in Power Pages — they determine what authenticated users can see and do on the portal.

Web Role structure:
Name: "Customer Standard"
Users: portal contacts assigned this role
Permissions: table permissions linked to this role

Special web roles:
Authenticated Users:  automatically assigned to ALL signed-in users
Anonymous Users:      automatically assigned to ALL non-signed-in users

Custom web roles examples:
→ Customer Basic: read own cases + create new cases
→ Customer Premium: read all cases for their account + create
→ Partner Manager: manage all partner accounts and opportunities
→ Portal Admin: manage portal content (pages, content snippets)
→ Knowledge Manager: publish/unpublish knowledge articles

Assigning web roles:
→ Manually: Portal Management app → Contacts → assign web role
→ Automatically: Power Automate flow → when user registers, assign role
→ Via invitation: send role-specific invitation links

Web Role + Table Permissions (together = access control):
Web Role defines WHO
Table Permission defines WHAT they can do to WHICH data

What are Table Permissions and how do they work?

Table Permissions (formerly Entity Permissions) define what authenticated or anonymous users can do with Dataverse data on the portal.

Table Permission configuration:
Table:      which Dataverse table (e.g., incident/Case)
Access type: Global, Contact, Account, Parent, Self
Privileges: Create, Read, Write, Delete, Append, AppendTo
Web Roles:  which web roles this permission applies to

Access types:
Global:  can access ALL records in the table (admin-level)
Contact: can only access records where Contact = logged-in user
Account: can access records belonging to the same Account
Parent:  can access child records via a parent relationship
Self:    Contact record can only access their own Contact record

Example — Customer case portal:
Table: incident (Case)
Access type: Contact (customerid = logged-in Contact)
Privileges: Create, Read, Write
Web Roles: [Authenticated Users]
→ Each user sees and edits ONLY their own cases

Example — Account manager portal:
Table: incident (Case)
Access type: Account (customerid.parentcustomerid = user's Account)
Privileges: Read
Web Roles: [Account Manager]
→ Account managers see all cases for their account company

Table permission hierarchy (child permissions):
Parent table: Account (Access type: Contact)
  Child table: Contact (Access type: Parent, via accountid)
→ User can read their own account AND contacts in that account

Critical: Without table permissions, portal users have NO access to any Dataverse data. Table permissions are additive — a user gets the union of all permissions from all their assigned web roles.


What is the portal registration and profile management flow?

New user registration flow:
1. User visits portal → clicks "Sign in"
2. Selects identity provider (Entra ID, Google, local account)
3. Completes IdP authentication
4. First time: portal creates/matches a Contact record in Dataverse
   Contact matching: by email address (configurable)
5. Optional: registration page for additional profile data
   (name, company, preferences — writes to Contact record)
6. Default web roles assigned: "Authenticated Users"
7. Optional: email confirmation required before full access
8. Custom roles: assigned manually or via Power Automate flow

Invitation flow (pre-approved access):
1. Admin creates Invitation record in Dataverse
2. Sets: invitation type (single/group), assigned web roles, expiry
3. Portal sends invitation email with unique link
4. User clicks link → completes registration
5. Assigned web roles applied automatically on redemption
6. Use for: partner onboarding, controlled external access

4. Liquid Templates & Customisation

What is Liquid and how is it used in Power Pages?

Liquid is an open-source template language used in Power Pages to generate dynamic HTML content. It allows web templates to access portal data, user context, and Dataverse records.

{# Liquid template example — personalised greeting and case list #}

{% if user %}
  <h1>Welcome back, {{ user.fullname }}!</h1>
  <p>Your open cases:</p>

  {% fetchxml %}
    <fetch mapping="logical" count="10">
      <entity name="incident">
        <attribute name="title" />
        <attribute name="statecode" />
        <attribute name="createdon" />
        <filter>
          <condition attribute="customerid" operator="eq"
            value="{{ user.id }}" />
          <condition attribute="statecode" operator="eq" value="0" />
        </filter>
        <order attribute="createdon" descending="true" />
      </entity>
    </fetch>
  {% endfetchxml %}

  {% if results.entities.size > 0 %}
    <ul>
    {% for case in results.entities %}
      <li>{{ case.title }} — Created: {{ case.createdon | date: "%d %b %Y" }}</li>
    {% endfor %}
    </ul>
  {% else %}
    <p>You have no open cases.</p>
  {% endif %}

{% else %}
  <p>Please <a href="/signin">sign in</a> to view your cases.</p>
{% endif %}

What are the key Liquid objects available in Power Pages?

{# Core Liquid objects #}

user          → currently authenticated portal user (Contact record)
  {{ user.fullname }}           ← Contact's full name
  {{ user.emailaddress1 }}      ← Contact's email
  {{ user.id }}                 ← Contact's GUID
  {{ user.roles }}              ← collection of web roles

page          → current webpage being rendered
  {{ page.title }}
  {{ page.adx_partialurl }}
  {{ page.breadcrumbs }}

website       → the portal website object
  {{ website.name }}
  {{ website.adx_primarydomainname }}

request       → current HTTP request
  {{ request.url }}
  {{ request.params['search'] }}  ← query string parameter
  {{ request.cookies['name'] }}

settings      → site settings (key-value store)
  {{ settings['Authentication/Registration/Enabled'] }}

snippets      → content snippets
  {{ snippets['site/tagline'] }}

now           → current date/time
  {{ now | date: "%Y-%m-%d" }}

Liquid filters (transform values):
  {{ value | upcase }}          ← UPPERCASE
  {{ value | downcase }}        ← lowercase
  {{ value | truncate: 50 }}    ← truncate to 50 chars
  {{ value | date: "%d %b %Y" }} ← format date
  {{ value | escape }}          ← HTML escape (XSS prevention)
  {{ value | default: "N/A" }}  ← default if null

What is FetchXML in Power Pages and how do you use it?

FetchXML is Dataverse's XML-based query language used within Liquid templates to retrieve data from Dataverse tables.

{# FetchXML example — get top 5 knowledge articles by rating #}
{% fetchxml %}
  <fetch mapping="logical" count="5">
    <entity name="knowledgearticle">
      <attribute name="title" />
      <attribute name="description" />
      <attribute name="adx_averagerating" />
      <filter type="and">
        <condition attribute="statecode" operator="eq" value="3" />  <!-- Published -->
        <condition attribute="isinternal" operator="eq" value="0" /> <!-- External -->
      </filter>
      <order attribute="adx_averagerating" descending="true" />
    </entity>
  </fetch>
{% endfetchxml %}

{% for article in results.entities %}
  <div class="article-card">
    <h3>{{ article.title }}</h3>
    <p>{{ article.description | truncate: 150 }}</p>
    <span>Rating: {{ article.adx_averagerating | round: 1 }}/5</span>
  </div>
{% endfor %}

{# FetchXML with linked entities (JOIN) #}
{% fetchxml %}
  <fetch mapping="logical">
    <entity name="incident">
      <attribute name="title" />
      <attribute name="statecode" />
      <link-entity name="contact" from="contactid" to="customerid" alias="cust">
        <attribute name="fullname" alias="customername" />
      </link-entity>
      <filter>
        <condition attribute="ownerid" operator="eq-userid" />
      </filter>
    </entity>
  </fetch>
{% endfetchxml %}

What is the Power Pages Web API and when do you use it?

The Power Pages Web API provides a RESTful endpoint for reading and writing Dataverse data from client-side JavaScript — enabling rich interactive experiences without page reloads.

// Power Pages Web API examples

// GET — read records (table permissions enforced):
const response = await fetch(
  '/_api/incidents?$select=title,statecode,createdon&$filter=statecode eq 0',
  {
    headers: {
      '__RequestVerificationToken': document.querySelector(
        'input[name="__RequestVerificationToken"]').value
    }
  }
);
const data = await response.json();
data.value.forEach(c => console.log(c.title));

// POST — create a record:
await fetch('/_api/incidents', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    '__RequestVerificationToken': getToken()
  },
  body: JSON.stringify({
    title: 'New Support Request',
    description: 'Issue description here',
    'customerid_contact@odata.bind': `/contacts(${userId})`
  })
});

// PATCH — update a record:
await fetch(`/_api/incidents(${caseId})`, {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    '__RequestVerificationToken': getToken()
  },
  body: JSON.stringify({ description: 'Updated description' })
});

// Key rules:
// → Table permissions enforced — users can only access permitted records
// → Anti-forgery token required for POST/PATCH/DELETE (CSRF protection)
// → Columns must be enabled for Web API in table settings
// → Use $select to limit returned columns

5. Dataverse Integration & Forms

How do Entity Forms work in Power Pages?

Entity Forms (Table Forms) surface Dataverse forms directly on the portal, allowing portal users to create, edit, or view Dataverse records.

Entity Form configuration:
Name:         friendly name for the form
Table:        which Dataverse table (e.g., incident)
Form:         which Dataverse form definition to use
Mode:         Insert (create), Edit, ReadOnly
Record source: QueryString (ID from URL), Current Portal User,
               Fixed Record (always same record)

Entity Form metadata:
→ Additional settings overlaid on the Dataverse form
→ Control: redirect after submit, success message
→ Validation: custom JavaScript validation
→ On Success: URL redirect, show message, or load another form step

Multi-step forms (Form Steps):
→ Wizard-style multi-page forms
→ Each step = one Entity Form
→ Steps linked via Web Form (multi-step form container)
→ Progress indicator, back/next navigation
→ Data saved incrementally between steps
→ Final step submits all data

Example — 3-step case creation wizard:
Step 1: "What is the issue?" → capture Title + Description
Step 2: "Contact details" → capture Contact info
Step 3: "Review and submit" → display summary + submit

Entity List on form:
→ Related records displayed below the main form
→ e.g., Case form with related Notes list below

How do Entity Lists work in Power Pages?

Entity Lists (Table Lists) display Dataverse records as searchable, filterable lists on the portal.

Entity List configuration:
Table:        which Dataverse table
View:         which Dataverse saved view to use (filter + columns)
Page size:    number of records per page (default 10)
Search:       enable/disable search across listed columns
Filter:       metadata filters (filter by date, status, lookup)
Actions:      Create (link to Entity Form), View, Edit, Delete actions

OData feed:
→ Entity List can expose an OData endpoint
→ External apps can consume portal data via OData
→ URL: /[listname]/odata — returns JSON
→ Filtered by table permissions (user only sees permitted records)

Subgrids:
→ Entity List embedded as a subgrid within an Entity Form
→ e.g., Account page shows all Cases for that Account
→ Configured via Entity List with parent filter

Portal search integration:
→ Entity List results included in portal search
→ Requires search enabled on the entity list
→ Records indexed based on view columns

How does SharePoint document management integrate with Power Pages?

SharePoint integration setup:
1. Enable SharePoint integration in Dataverse (Power Platform Admin Centre)
2. Configure document location: Dataverse record → SharePoint folder
3. Portal displays document library on Entity Form

How it works:
→ User opens a Case record on the portal
→ Entity Form displays "Documents" section (if configured)
→ Documents stored in SharePoint (not Dataverse attachment)
→ Portal fetches document list via SharePoint integration
→ User can upload/download documents from the portal
→ Files stored in SharePoint → version history, large file support

Supported operations via portal:
→ View document list for a record
→ Upload new documents (stored in SharePoint)
→ Download documents
→ Delete documents (with appropriate permissions)

Limitations:
→ Requires SharePoint integration enabled at environment level
→ SharePoint must be in same M365 tenant
→ Anonymous users cannot access SharePoint-integrated documents

6. ALM, Security & Performance

How do you manage Application Lifecycle Management (ALM) for Power Pages?

Power Pages ALM approach:

1. Dataverse Solutions:
   → Package portal metadata in a Dataverse solution
   → Solution contains: webpages, web templates, entity forms/lists,
     table permissions, web roles, site settings, content snippets
   → Export as managed solution (for target environments)
   → Import into Test → UAT → Production

2. Power Platform CLI (pac cli):
   → pac pages upload / download — sync portal files to/from local disk
   → Local editing: edit Liquid templates, CSS, JS in VS Code
   → Upload changes back to Dataverse portal tables
   → pac solution export/import for full solution-based ALM

3. Source control (Git):
   → Export portal files with pac CLI → commit to Git
   → Enables: version history, PR review of template changes,
     branch-based development
   → CI/CD: GitHub Actions / Azure DevOps pipeline using pac CLI

4. Environment variables:
   → Site settings that differ between environments
   → Dev: dev.contoso.com, Prod: portal.contoso.com
   → Connection strings, API endpoints, feature flags

ALM workflow:
Developer → local edit → pac upload → Dev environment test
         → pac solution export → PR review
         → merge → automated pipeline → UAT → Production

What are the key security considerations for Power Pages?

Security layers:

1. Table permissions (data layer):
   → Always configure — no table permissions = no data access
   → Follow least privilege — start restrictive, open as needed
   → Test with different user types (anonymous, authenticated, roles)
   → Audit table permissions regularly

2. HTTPS (transport layer):
   → Always enforced — Power Pages provides SSL certificate automatically
   → Custom domain: upload your own SSL certificate or use Let's Encrypt

3. Content Security Policy (CSP):
   → Configure allowed script/style sources
   → Prevent XSS attacks via CSP headers
   → Site setting: HTTP/X-Content-Security-Policy

4. Anti-forgery tokens:
   → Required for all POST/PATCH/DELETE Web API calls
   → Prevents CSRF attacks
   → Built into Entity Forms automatically

5. Rate limiting:
   → Configure site settings to limit API call frequency per user
   → Prevents abuse of Web API endpoints

6. Bot protection:
   → Configure reCAPTCHA or Cloudflare Turnstile on registration + forms
   → Site setting: Recaptcha/Enabled, Recaptcha/PublicKey

7. IP restrictions:
   → Restrict portal access to specific IP ranges
   → Site setting: Maintenance Mode for controlled access

8. Authentication hardening:
   → Disable local authentication in production (use federated IdPs)
   → Configure session timeout (Site/SessionTimeoutEnabled)
   → Require email confirmation for registration

9. Content hiding vs Table Permissions:
   → Hiding a page in navigation does NOT secure the data
   → Table Permissions control actual data access
   → "Security through obscurity" is not security — always use table permissions

What are Power Pages performance best practices?

Caching:
→ Portal output caching: pages cached for 15 minutes by default
→ Clear cache: Power Pages studio → Sync (clears portal cache)
→ Partial caching: use {% cache %} tag for expensive Liquid blocks
→ Static files: served via CDN (Azure CDN) — always fast

FetchXML optimisation:
→ Use count attribute to limit records returned
→ Use $select equivalent — only fetch needed attributes
→ Avoid N+1 queries: use link-entity instead of nested loops
→ Index frequently filtered columns in Dataverse

Entity List performance:
→ Set reasonable page size (10-25 records)
→ Ensure Dataverse view has appropriate filters (don't load all records)
→ Index columns used in view filters

Web API performance:
→ Always use $select to limit returned columns
→ Use $top to limit result count
→ Avoid calls on page load for non-critical data — lazy load

Liquid template performance:
→ Avoid complex Liquid in high-traffic page templates
→ Use content snippets for frequently changing small content
→ Minimise FetchXML calls per page (each = a Dataverse query)

CDN and static assets:
→ Use web files for CSS/JS (served via CDN)
→ Compress images before uploading as web files
→ Minimise inline CSS/JS in web templates

7. Scenario-Based Questions

Scenario: Design a customer self-service portal for a financial services company.

Requirements: Customers log in, view their accounts, create service requests, track case status, and download statements.

  1. Authentication: Azure AD B2C with custom branding. Email/password + optional social login. MFA enforced via B2C policy. Contact matching by email.

  2. Portal structure:

    • Home (public) — product information, login CTA
    • My Account (authenticated) — account details, balance, contact info
    • Service Requests (authenticated) — create new case, view case history
    • Documents (authenticated) — download statements from SharePoint
    • Knowledge Base (public) — FAQ, guides
  3. Web Roles:

    • Authenticated Customers — read own account, create cases, view own cases
    • Premium Customers — all above + priority case routing flag
  4. Table Permissions:

    • Contact: Self access → read own Contact record
    • Account: Contact access → read their associated Account
    • Incident (Case): Contact access → create + read own cases
    • KnowledgeArticle: Global → read published external articles
  5. Forms:

    • Case creation: multi-step form (Issue type → Details → Confirmation)
    • Case detail: read-only view with status timeline
    • Profile update: edit mode for Contact email/phone
  6. Security: reCAPTCHA on registration and case creation. CSP headers configured. Disable local authentication — B2C only.

  7. ALM: solution-based deployment. Dev → UAT → Production pipeline via GitHub Actions + pac CLI.


Scenario: How do you restrict a portal page to users with a specific web role?

Three approaches (all needed together for full security):

1. Page visibility in navigation:
   → Webpage → Publishing State: Published
   → Web Role restriction on webpage: only visible to "Premium Customers" role
   → Page does NOT appear in navigation for other users
   → This is NOT security — page URL may still be accessible directly

2. Webpage Access Control (Entity Permission on Webpage):
   → Associate the webpage with a specific web role
   → Users without the role see: 403 Forbidden or redirect to sign-in
   → Configured via: Webpage → Web Roles (many-to-many relationship)
   → This IS the correct security control for pages

3. Table Permissions (data layer):
   → Even if user accesses the page, data is only visible if
     table permissions allow it
   → Defence in depth: page access + data access both restricted

Example:
Webpage "Premium Dashboard":
  Web Roles: [Premium Customers]    ← page access
  Entity List on page:
    Table: financial_statement
    Access: Account
    Web Roles: [Premium Customers]  ← data access

Result: non-Premium users cannot see the page AND cannot access
the data even if they somehow reach the URL.

Scenario: How do you implement a multi-language portal?

Power Pages multi-language support:

1. Enable languages:
   → Portal Management app → Website → Supported Languages
   → Add languages: en-US (default), fr-FR, de-DE, es-ES
   → Install language packs for each language

2. Content localisation:
   → Webpages: create a localised copy per language
     Home (en-US) → Home (fr-FR) → Home (de-DE)
   → Content Snippets: create per-language versions
   → Entity Form labels: localised via Dataverse column label translations

3. Language switcher:
   → Liquid template: loop through supported languages
   {% for lang in website.supported_languages %}
     <a href="{{ request.url | set_language: lang.code }}">
       {{ lang.name }}
     </a>
   {% endfor %}

4. URL structure:
   → Language in URL: /en-US/home, /fr-FR/home
   → Or: subdomain — en.portal.contoso.com, fr.portal.contoso.com

5. Right-to-left (RTL) support:
   → Enable RTL for Arabic (ar), Hebrew (he)
   → Configure Bootstrap RTL CSS for RTL languages

6. Browser language auto-detection:
   → Site setting: Globalization/AutoDetectLanguage = true
   → Portal automatically redirects to preferred language based on
     browser Accept-Language header

Scenario: How do you troubleshoot a portal page that shows no data despite the user being authenticated?

Diagnostic checklist:

1. Check if user is authenticated:
   Liquid: {% if user %}...{% endif %}
   → If user object is empty: authentication not completing → check IdP config

2. Check Web Role assignment:
   → Portal Management app → Contacts → find user → Web Roles
   → Verify "Authenticated Users" role is assigned (should be automatic)
   → Verify custom role is assigned if page requires specific role

3. Check Table Permissions:
   → Portal Management app → Table Permissions → find permission for the table
   → Verify: correct table, correct access type, correct web roles, correct privileges
   → Permission must have Read privilege for data to display

4. Check if Entity List/Form has correct table:
   → Verify Entity List points to the correct Dataverse table
   → Verify the Dataverse view used exists and returns data in model-driven app

5. Check FetchXML (if custom Liquid):
   → Add debug output: {{ results | dump }}
   → Check if FetchXML returns data in XrmToolBox FetchXML Builder
   → Verify filter conditions match actual data values

6. Check Portal Cache:
   → Design Studio → Sync (clears portal output cache)
   → Table permission changes require cache clear to take effect

7. Check browser console:
   → Web API errors appear in browser console
   → 403: table permission blocking access
   → 401: user not authenticated for this API call
   → 500: server error — check portal diagnostic logs

8. Enable portal diagnostics:
   → Append ?enableportaldiagnostics=true to URL
   → Shows diagnostic information for admins

8. Cheat Sheet — Quick Reference

Power Pages Component Summary

Webpages:          URL-addressable pages, publish/draft state
Web Templates:     Liquid + HTML templates assigned to pages
Content Snippets:  Reusable text/HTML fragments
Entity Forms:      Dataverse forms (create/edit/read)
Entity Lists:      Dataverse views displayed as lists
Web Roles:         Access groups controlling what users can see/do
Table Permissions: Data access control (who reads/writes which records)
Web Files:         Static assets (CSS, JS, images, PDFs)
Site Settings:     Key-value portal configuration

Table Permission Access Types

Global:  ALL records in the table (use sparingly — admin-level)
Contact: records WHERE contact lookup = logged-in user
Account: records WHERE account lookup = user's parent account
Parent:  child records accessible via parent record permission
Self:    Contact record = user's own Contact only

Privileges: Create | Read | Write | Delete | Append | AppendTo

Example combinations:
Cases (own): Table=incident, Access=Contact, Priv=Create+Read+Write
Cases (account): Table=incident, Access=Account, Priv=Read
Articles: Table=knowledgearticle, Access=Global, Priv=Read
Own profile: Table=contact, Access=Self, Priv=Read+Write

Key Liquid Objects

{{ user }}              → authenticated Contact record
{{ user.fullname }}     → Contact display name
{{ user.id }}           → Contact GUID
{{ user.roles }}        → collection of web role names
{{ page.title }}        → current page title
{{ page.adx_partialurl }} → current page URL segment
{{ request.url }}       → full current URL
{{ request.params['key'] }} → query string value
{{ settings['key'] }}   → site setting value
{{ snippets['name'] }}  → content snippet value
{{ now }}               → current datetime

Authentication Provider Site Settings

Key site settings for authentication:
Authentication/Registration/Enabled = true/false
Authentication/Registration/RequiresConfirmation = true/false
Authentication/Registration/LocalLoginEnabled = false (production)
Authentication/Registration/ExternalLoginEnabled = true

Azure AD:
Authentication/OpenIdConnect/AzureAD/Authority = https://login.microsoftonline.com/{tenantId}/v2.0
Authentication/OpenIdConnect/AzureAD/ClientId = {appId}
Authentication/OpenIdConnect/AzureAD/ClientSecret = {secret}

Google:
Authentication/OpenIdConnect/Google/Authority = https://accounts.google.com
Authentication/OpenIdConnect/Google/ClientId = {clientId}

Session:
Site/SessionTimeoutEnabled = true
Site/SessionTimeoutMinutes = 30

ALM Quick Reference

pac CLI commands for Power Pages:
pac auth create --url https://contoso.crm.dynamics.com
pac pages upload --path ./portal-root --deploymentProfile dev
pac pages download --path ./portal-root --environment contoso-dev
pac solution export --name PortalSolution --path ./solutions --managed
pac solution import --path ./solutions/PortalSolution_managed.zip

Environment-specific settings:
→ Use Dataverse environment variables for site settings
→ Dev/Test/Prod have different values for:
   Portal URL, API endpoints, reCAPTCHA keys, email settings

GitHub Actions pipeline example:
1. pac auth create (service principal)
2. pac solution import (deploy portal solution)
3. pac pages upload (deploy template/file changes)
4. Clear portal cache (POST to /_services/about/clearcache)

Top 10 Tips

  1. Table Permissions are mandatory — without them, authenticated users see NO Dataverse data. The most common portal configuration mistake is forgetting to set table permissions. Start here in any debugging scenario.

  2. Web Roles control page access, Table Permissions control data access — both are needed for full security. A page visible to the wrong role but with correct table permissions still shows no data. A page hidden but without table permissions is security-through-obscurity only.

  3. Power Pages vs model-driven apps — Power Pages serves external users (customers/partners), model-driven serves internal users (employees). They use the same Dataverse but different access mechanisms (table permissions + web roles vs Dataverse security roles).

  4. Authenticated Users web role is automatic — every signed-in user gets this role automatically. Design your table permissions baseline around this role. Custom roles are additive on top.

  5. FetchXML is the query language — know the basic structure: fetch → entity → attribute + filter + order. Use link-entity for joins. Use alias for linked entity attributes. This comes up in every advanced Power Pages technical round.

  6. Portal cache must be cleared after table permission changes — table permission changes don't take effect immediately. Clear cache in Design Studio or sync via pac CLI. A frustrating "why isn't this working?" scenario solved by a cache clear.

  7. Anti-forgery token required for Web API — POST/PATCH/DELETE calls without __RequestVerificationToken return 400 Bad Request. Always retrieve this token from the hidden input on the page and include in API request headers.

  8. pac CLI is the ALM tool — pac pages upload/download syncs portal files to/from disk for source control. Know the basic commands. Every enterprise Power Pages project uses this for CI/CD.

  9. Multi-step forms = Web Form + Form Steps — not just multiple Entity Forms. The Web Form container manages session state between steps. Each step is a separate Entity Form but data persists until final submit.

  10. Disable local authentication in production — local accounts (email/password managed by portal) should be disabled for enterprise portals. Use federated identity providers (Entra ID, Azure AD B2C) for proper security, audit trails, and MFA support.



Wednesday, May 6, 2026

Microsoft Entra ID (Azure Active Directory) Complete Guide

Microsoft Entra ID (Azure Active Directory) — Complete Guide

Identity Management · Authentication · Conditional Access · PIM · Hybrid Identity · B2B · Zero Trust · Scenarios · Cheat Sheet


Table of Contents

  1. Core Concepts — Basics
  2. Identity & Authentication
  3. Access Control & RBAC
  4. Identity Protection & Conditional Access
  5. Hybrid Identity & B2B
  6. Privileged Identity Management (PIM)
  7. Scenario-Based Questions
  8. Cheat Sheet — Quick Reference

1. Core Concepts — Basics

What is Microsoft Entra ID and how does it differ from Active Directory?

Microsoft Entra ID (formerly Azure Active Directory / Azure AD) is Microsoft's cloud-based Identity and Access Management (IAM) service. It is NOT Active Directory moved to the cloud — it is a fundamentally different identity platform.

Active Directory Domain Services (AD DS) — on-premises:
→ Protocol: Kerberos, NTLM, LDAP
→ Structure: forests, domains, OUs, GPOs
→ Objects: computers, printers, users, groups
→ Authentication: Kerberos tickets to domain-joined machines
→ Use: corporate network, on-prem apps, file shares
→ Management: AD Users & Computers, Group Policy

Microsoft Entra ID — cloud:
→ Protocol: OAuth 2.0, OpenID Connect, SAML 2.0
→ Structure: tenant (flat — no OUs, no GPOs, no forests)
→ Objects: users, groups, service principals, managed identities, devices
→ Authentication: JWT access tokens, refresh tokens
→ Use: cloud apps, SaaS (M365, Salesforce), external users
→ Management: Azure Portal, Graph API, PowerShell

Key distinctions:
→ No Kerberos or NTLM in Entra ID
→ No Organisational Units (OUs) — flat directory
→ No Group Policy Objects (GPOs) — use Intune/Conditional Access
→ Manages internet-facing identities, not domain-joined machines

Tip: The most common mistake is confusing Entra ID with AD DS. They coexist — Entra Connect synchronises identities from AD DS to Entra ID for hybrid environments.


What is a Microsoft Entra ID tenant and its key components?

A tenant is a dedicated, isolated instance of Entra ID representing one organisation. Created when signing up for M365 or Azure. Has a unique tenant ID (GUID) and primary domain (contoso.onmicrosoft.com).

Component Description
Users Member users (employees) and guest users (B2B externals)
Groups Security groups, M365 Groups, Distribution groups
App Registrations Your apps calling Graph/APIs — developer-owned definitions
Enterprise Applications SaaS apps + service principals (runtime instances)
Service Principals Identity of an application within a specific tenant
Managed Identities System or user-assigned identity for Azure resources
Devices Entra registered, Entra joined, or Hybrid Entra joined

Tip: Tenant ID = the organisation's Entra directory. Application (Client) ID = the app registration. Object ID = unique identifier of any directory object. Know all three.


What are the Entra ID licence tiers?

Entra ID Free (included with Azure/M365):
→ User/group management, SSO for 10 apps per user
→ Basic MFA for admins, self-service password reset (cloud only)
→ Entra Connect sync from AD DS

Entra ID P1 (M365 E3 / EMS E3):
→ All Free features +
→ Full Conditional Access policies
→ Hybrid identity (with password writeback)
→ Identity Protection (sign-in risk detection)
→ Dynamic groups
→ Application Proxy (publish on-prem apps)
→ Self-service password reset with on-prem writeback

Entra ID P2 (M365 E5 / EMS E5):
→ All P1 features +
→ Privileged Identity Management (PIM)
→ Identity Protection (user risk policies)
→ Access Reviews
→ Entitlement Management

Critical licensing facts:
Full Conditional Access  → P1 minimum
PIM                      → P2 required
User risk policies        → P2 required
Access Reviews           → P2 required
Dynamic groups           → P1 required

2. Identity & Authentication

What authentication methods does Entra ID support?

Method Phishing Resistant Notes
FIDO2 security keys Yes Highest security — YubiKey, hardware tokens
Windows Hello for Business Yes Biometric/PIN tied to device TPM — passwordless
Certificate-based auth Yes X.509 certificates, smart cards
Microsoft Authenticator (push) Yes (with number matching) Most practical MFA method
OATH TOTP tokens No Authenticator app TOTP codes
Temporary Access Pass (TAP) N/A Time-limited passcode for bootstrapping/recovery
SMS / Voice call OTP No Vulnerable to SIM swap — not recommended
Password No Weakest — being phased out as primary auth

Tip: Microsoft's recommended path: Password → Authenticator with number matching → FIDO2/Windows Hello → passwordless. Always move away from SMS — SIM swap attacks make it unreliable.


What is SSO in Entra ID and what protocols does it use?

SSO allows users to authenticate once with Entra ID and access multiple applications without re-entering credentials.

SSO protocols:

OpenID Connect (OIDC):
→ Modern, built on OAuth 2.0
→ Returns ID token (JWT) with user claims
→ Best for: modern web/mobile apps, custom apps, M365 integrations

SAML 2.0:
→ XML-based enterprise federation standard
→ Returns SAML assertion with user attributes
→ Best for: enterprise SaaS apps (Salesforce, ServiceNow, SAP, Workday)

Password-based SSO:
→ Entra ID stores/injects credentials into apps
→ For legacy apps with no federation support
→ Requires browser extension

App Proxy SSO (on-prem apps):
→ Publish on-prem web apps through Entra ID App Proxy
→ User authenticates to Entra ID → App Proxy forwards to on-prem
→ Supports: Kerberos Constrained Delegation, header-based

OIDC SSO flow:
1. User accesses app → redirect to login.microsoftonline.com
2. Authenticates (MFA if CA requires it)
3. Entra ID issues ID token + access token
4. Tokens returned to app → user logged in
5. Subsequent apps: silent token reuse (no re-login)

What is the difference between App Registration and Enterprise Application?

App Registration: global definition of your application in the developer's home tenant. Defines: application ID, redirect URIs, API permissions, client secrets/certificates, exposed API scopes.

Enterprise Application (Service Principal): local instance of an application within a specific tenant. Created when an app is consented to. Controls: who can access, SSO settings, provisioning, Conditional Access assignment.

Relationship:
App Registration (global, developer's home tenant)
  → When consented in same tenant: creates Service Principal (Enterprise App)
  → When consented in another tenant: creates Service Principal there too

Multi-tenant app:
App Registration in Tenant A (developer)
  → Service Principal in Tenant A (same tenant use)
  → Service Principal in Tenant B (Tenant B admin consents)
  → Service Principal in Tenant C (Tenant C admin consents)

Gallery SaaS apps (Salesforce, Workday):
→ Enterprise Application (Service Principal) in your tenant
→ No App Registration (owned by the ISV)

Tip: App Registration = APPLICATION definition (developer-owned). Service Principal = APPLICATION INSTANCE in a tenant (runtime identity). One app registration → many service principals across tenants.


What is a Managed Identity?

Managed Identity is an automatically managed Azure identity for Azure resources — no credentials to manage.

Types:
System-assigned: created when enabled on a resource (VM, Function App, Logic App)
                 tied to resource lifecycle — deleted when resource deleted
                 one-to-one with the resource

User-assigned:   standalone Azure resource
                 assigned to multiple Azure resources
                 independent lifecycle
                 use when multiple resources share the same identity

Why prefer Managed Identity over Service Principal + secret:
Service Principal + secret:
→ Secret must be generated, stored, rotated, and kept secure
→ Rotation failure → app breaks
→ Secret can be leaked (committed to Git, exposed in logs)
→ Manual credential management overhead

Managed Identity:
→ No credentials to manage
→ No secret to rotate or leak
→ Azure IMDS issues tokens automatically to the resource
→ RBAC assignments control what the identity can access

Code comparison:
// With client secret (requires management):
var credential = new ClientSecretCredential(tenantId, clientId, secret);

// With managed identity (zero credential management):
var credential = new DefaultAzureCredential();
// Uses managed identity in Azure, developer credentials locally

Tip: Managed Identity is the answer to any "how do you securely authenticate an Azure resource to another Azure service" question. Always recommend over service principal + secret.


3. Access Control & RBAC

What is Azure RBAC and how does it work?

Azure RBAC components:
Security principal: WHO gets access (User, Group, Service Principal, Managed Identity)
Role definition:    WHAT they can do (built-in or custom set of allowed actions)
Scope:              WHERE it applies (Management Group > Subscription > RG > Resource)
Role assignment:    WHO + WHAT + WHERE (combination of above three)

Scope hierarchy (parent roles inherited by children):
Management Group → Subscription → Resource Group → Resource

Key built-in roles:
Owner                    → full access + manage RBAC assignments
Contributor              → full resource management, CANNOT manage RBAC
Reader                   → read-only access to all resources
User Access Administrator → manage RBAC only, no resource access

Role inheritance example:
Subscription: Alice = Reader
  Resource Group A: Alice = Contributor (overrides subscription Reader)
    Resource 1: Alice inherits Contributor from RG A
    Resource 2: Alice inherits Contributor from RG A
  Resource Group B: Alice inherits Reader from Subscription

Tip: Owner = Contributor + ability to assign RBAC roles. Never give Owner to service accounts — use Contributor + specific additional roles only where needed.


What are Entra ID roles vs Azure RBAC roles?

Entra ID roles (directory roles):
→ Control operations on Entra ID directory itself
→ Examples: Global Administrator, User Administrator,
            Conditional Access Administrator, Security Reader,
            Application Administrator, Groups Administrator
→ Assigned via: Entra admin centre or PIM
→ Apply to: tenant-wide directory operations

Azure RBAC roles (resource roles):
→ Control operations on Azure resources
→ Examples: Owner, Contributor, Reader, Key Vault Secrets Officer,
            Storage Blob Data Contributor, Virtual Machine Operator
→ Assigned via: Azure Portal IAM blade, CLI, or Terraform
→ Apply to: management group / subscription / resource group / resource

CRITICAL: These are completely separate permission systems:
Global Admin ≠ Owner:
→ Global Admin can reset any user's password (directory operation)
→ Global Admin has NO Azure resource access by default
→ Azure Owner has NO Entra ID admin access by default

Exception (nuclear option):
Global Admin can ELEVATE themselves to User Access Administrator
on the root management group — gaining access to ALL Azure resources.
Use with extreme caution and audit trail.

What are dynamic groups?

Dynamic groups automatically manage membership based on rules evaluated against user or device attributes.

Dynamic user group rules:
user.department -eq "Finance"
user.jobTitle -contains "Manager"
user.country -eq "UK"
(user.department -eq "Finance") -or (user.department -eq "Accounting")

Dynamic device group rules:
device.deviceOSType -eq "Windows"
device.managementType -eq "MDM"
device.enrollmentProfileName -eq "Corporate"

Use cases:
→ Auto-assign M365 licences: "Sales" dept → Salesforce licence
→ Auto-apply Conditional Access: all contractors → restricted policy
→ Auto-provision SharePoint access by department
→ Auto-assign Intune device policies by OS type

Requirements: Entra ID P1 licence for dynamic user groups
Sync time: membership evaluated within 24 hours of attribute change

Tip: Dynamic groups eliminate manual membership management. When user joins Finance department, they automatically get all Finance group memberships — and all access those groups grant. Leaving removes access automatically.


What are Access Reviews?

Access Reviews (Entra ID P2) provide periodic automated reviews of access rights — ensuring users still need the access they have.

Review Type What Is Reviewed
Group membership Do members still need group membership?
Application access Do users still need access to an enterprise app?
Privileged roles Do admins still need their admin roles? (PIM integrated)
Guest users Do external guests still need access to the tenant?
Configuration:
Reviewers:    self / manager / specific users / group owners
Frequency:    one-time / weekly / monthly / quarterly / annually
Duration:     7, 14, or 30 days for reviewers to respond
On no response: auto-approve (lenient) or auto-deny (strict — recommended)
Apply results: automatically remove access when denied

Compliance value:
→ SOC 2 Type II: evidence of periodic access reviews
→ ISO 27001 A.9.2.5: user access reviews requirement
→ GDPR: evidence of regular personal data access review
→ Export review results as compliance audit evidence

4. Identity Protection & Conditional Access

What is Entra ID Identity Protection?

Identity Protection uses ML to detect suspicious sign-in patterns and compromised credentials, generating risk signals used by Conditional Access.

Sign-in risk (per authentication):
→ Anonymous IP address (Tor, VPN proxies)
→ Atypical travel (impossible travel — London then NY within 1 hour)
→ Malware-linked IP address
→ Unfamiliar sign-in properties (new device, location, browser)
→ Password spray attack detected
→ Token issuer anomaly

User risk (accumulates over time):
→ Leaked credentials (found in dark web breach dumps)
→ Azure AD threat intelligence (known attack patterns)
→ Anomalous user activity

Risk levels: Low / Medium / High / None

Conditional Access risk-based policies (P2 required):
Sign-in risk ≥ Medium → require MFA re-authentication
Sign-in risk = High   → block access
User risk = High      → require password change + MFA
User risk = Medium    → require MFA

Self-remediation:
→ User completes MFA → sign-in risk cleared (no admin needed)
→ User changes password → user risk cleared (no admin needed)

What is Conditional Access?

Conditional Access is the Entra ID policy engine evaluating signals and enforcing access decisions — the "if/then" engine of Zero Trust.

# Conditional Access policy structure:
WHEN (Assignments):
  Users:    All users / specific groups / guest users
  Apps:     All cloud apps / specific apps
  Conditions:
    Sign-in risk:    Low / Medium / High (Identity Protection)
    User risk:       Low / Medium / High (Identity Protection)
    Device platform: Windows / iOS / Android / macOS
    Location:        Named locations (trusted IPs / countries)
    Client apps:     Browser / Mobile apps / Legacy auth
    Device state:    Compliant / Hybrid joined / Unregistered

THEN (Grant controls):
  Block access
  OR Allow with:
    Require MFA
    Require device compliance (Intune)
    Require hybrid Entra join
    Require approved client app
    Require app protection policy

Session controls:
  Sign-in frequency:        re-auth every N hours
  Persistent browser:       No (close browser = sign out)
  App-enforced restrictions: browser-only on SharePoint

Key policies to implement:
1. Require MFA for ALL users (exclude break-glass accounts)
2. Block legacy authentication (HIGHEST IMPACT — single policy)
3. Require compliant device for Office 365
4. Browser-only for personal/unmanaged devices
5. Block access from high-risk sign-in locations
6. Risk-based: MFA on medium risk, block on high risk

What are Named Locations and Continuous Access Evaluation?

Named Locations:
→ Define trusted IP ranges (corporate office, VPN) or countries
→ Used in Conditional Access conditions
→ Types: IP ranges (CIDR notation) / Countries/Regions

Use cases:
→ Allow access without MFA from trusted corporate IPs
→ Block access from specific high-risk countries
→ Identity Protection: trusted IP sign-ins get lower risk signal
→ Exclude break-glass accounts: allow access from named trusted IPs

Sign-in frequency:
→ Forces re-authentication after specified period
→ Every 1 hour: high security apps (financial, HR)
→ Every 8 hours: standard business apps
→ Every 24 hours: moderate security apps
→ Never persistent: session ends on browser close (shared computers)

Continuous Access Evaluation (CAE):
→ Near real-time token revocation (not waiting for token expiry)
→ User disabled in Entra ID → token revoked within minutes
→ User location changes → session re-evaluated immediately
→ Supported by: Exchange Online, SharePoint, Teams, Azure services
→ Default token lifetime (1 hour) without CAE can leave compromised
  accounts active for up to 1 hour after disabling

What are break-glass accounts?

Break-glass accounts are emergency access accounts used only when all normal admin access paths fail.

Requirements:
→ Minimum 2 accounts (each a backup for the other)
→ Cloud-only (not synced from AD — immune to on-prem outages)
→ No MFA requirement (accessible even if MFA infrastructure fails)
→ 25+ character random passwords stored physically (safe or split custody)
→ No licences assigned (reduces attack surface)
→ Excluded from ALL Conditional Access policies
→ Monitored: alert on ANY sign-in (Azure Sentinel / Monitor alert)

Configuration:
→ Role: Global Administrator (permanent active, not eligible)
→ CA exclusion: add both accounts to exclusion group in all CA policies
→ Account type: use .onmicrosoft.com UPN (not custom domain — domain
  could become unavailable)
→ MFA: skip MFA requirement (but store in secure physical location)
→ Password: document in physical safe + rotate annually

Critical: If you lock yourself out without break-glass accounts, recovery requires contacting Microsoft Support — which can take hours. Break-glass accounts are mandatory for any production Entra ID tenant.


What is Entra ID Password Protection?

Components:
Global banned password list:
→ Microsoft maintains 100,000+ commonly breached passwords
→ Applied automatically to ALL Entra ID tenants
→ Not configurable — always enforced

Custom banned password list (P1/P2):
→ Admin adds org-specific terms (company name, product names, city)
→ Up to 1,000 custom entries
→ Variations auto-detected: ContosoW1nter2024! → matches "Contoso" + "Winter"

Smart lockout:
→ Locks account after N failed attempts (configurable threshold)
→ Distinguishes attacks from legitimate mistyping
→ Lockout duration increases exponentially
→ Cloud and on-prem lockout counters maintained separately

On-premises Password Protection:
→ Deploy DC Agent on ALL domain controllers
→ Enforces same banned password list for AD DS password changes
→ Extends cloud protection to on-prem AD
→ Critical for hybrid environments — commonly missed control

5. Hybrid Identity & B2B

What is Entra Connect and how does hybrid identity work?

Microsoft Entra Connect (formerly Azure AD Connect) synchronises identities from AD DS to Entra ID.

Authentication methods:

Password Hash Sync (PHS) — RECOMMENDED:
→ Hash of password hash synced to Entra ID
→ Authentication happens IN ENTRA ID (cloud)
→ Works even if on-prem is unavailable
→ Enables leaked credential detection (Identity Protection)
→ Simplest to deploy and maintain

Pass-Through Authentication (PTA):
→ Auth request forwarded to PTA agent on on-prem AD
→ Authentication happens AGAINST ON-PREM AD
→ Password never leaves on-prem
→ Requires on-prem infrastructure available during auth
→ Cannot detect leaked credentials (no password hash in cloud)
→ Use when: policy prohibits any password data in cloud

Federation (AD FS):
→ Full federation with on-prem AD FS or third-party IdP
→ Most complex, most expensive, most maintenance
→ Use when: smart cards, advanced on-prem auth scenarios
→ Microsoft recommends migrating away from AD FS

Writeback features:
Password writeback: password reset in cloud → writes back to AD DS
Group writeback:    M365 Groups written back to AD as distribution lists
Device writeback:   Entra ID device objects written back to AD

What is Entra ID B2B collaboration?

Entra ID B2B enables organisations to invite external users to collaborate using their own credentials — no separate accounts needed.

B2B invitation flow:
1. Admin/user invites: partner@fabrikam.com
2. Guest receives email invitation
3. Guest redeems → consent screen
4. Guest user object created in Contoso's Entra ID
   (userType = "Guest", UPN = partner_fabrikam.com#EXT#@contoso.onmicrosoft.com)
5. Guest accesses resources granted to them

Supported identity providers for guests:
→ Entra ID / Azure AD (partner has M365) → federated sign-in
→ Microsoft personal account
→ Google Workspace → Google federation
→ Email OTP: for users without any supported IdP

Cross-tenant access settings:
Inbound:  control what external tenants can access in YOUR tenant
Outbound: control what YOUR users can access in external tenants
Trust:    trust MFA claims from specific partner tenants
          (avoids double MFA prompt for trusted partners)

B2B vs B2C:
B2B: partner/vendor enterprise users — use their own org identities
     Managed in Entra ID as guest users
     Use case: partner project collaboration

B2C: consumer-facing apps — customers create local accounts or use
     social IdPs (Google, Facebook, Apple)
     Separate Azure AD B2C tenant (NOT your corporate Entra ID)
     Use case: customer-facing applications

What are Entra ID device join options?

Type Ownership AD DS Required Managed By SSO
Entra ID Registered Personal (BYOD) No Optional Intune Cloud apps only
Entra ID Joined Corporate No Intune recommended Cloud + on-prem (with PHS)
Hybrid Entra ID Joined Corporate Yes Intune or GPO Cloud + on-prem (Kerberos)

Tip: Hybrid Entra ID Joined = migration path for existing AD DS estates. New devices in cloud-first organisations should use Entra ID Joined — no AD DS required.


What is Entitlement Management?

Entitlement Management (P2 / Governance) automates access request, approval, assignment, and review for groups, apps, and SharePoint sites.

Key components:
Access packages: bundle of resources requestable by users
                 (groups + app roles + SharePoint sites)
Policies:        who can request, approval workflow, duration, expiry, reviews
Catalogs:        containers for access packages (HR catalog, IT catalog)
Connected orgs:  allow external B2B users to request access packages

Example: "Finance Analyst" access package
Resources:
  → Finance SharePoint site (Member)
  → Finance M365 Group (Member)
  → SAP Finance role (Viewer)

Policy:
  Requestable by: Finance department employees + approved external auditors
  Approval:       Finance manager approval required
  Duration:       90 days (auto-expires)
  Access review:  quarterly
  External users: allowed (connected organisations)

User journey:
1. User visits myaccess.microsoft.com
2. Requests "Finance Analyst" access package + justification
3. Manager approves/denies (email + Teams notification)
4. On approval: user gets all 3 resource accesses simultaneously
5. After 90 days: access expires automatically
6. Quarterly review: manager recertifies or access revoked

6. Privileged Identity Management (PIM)

What is PIM and how does it work?

PIM provides just-in-time (JIT) privileged access — elevated roles only when needed, for limited time, with approval and audit trail.

Role assignment types:
Eligible:  user CAN activate the role but is not currently active
Active:    role is live — user has elevated permissions now
Permanent: always active (break-glass accounts only)

JIT activation flow:
1. User requests role activation (selects role + duration + justification)
2. Approval notification sent to designated approvers
3. Approver approves/denies (with optional MFA requirement)
4. Role becomes Active for the specified duration
5. After duration: role auto-deactivates
6. Full audit trail: who activated, why, when, duration, approver

Without PIM:
Global Admin permanently assigned → compromised account =
attacker has Global Admin access 24/7

With PIM:
Global Admin eligible → user activates for 2 hours when needed
→ Justification: "Creating new app registration for Project X"
→ Approval: IT Security manager approves
→ 2 hours later: role expires automatically
→ Compromised account: attacker has NO elevated access

PIM activation settings (configurable per role):
Max duration:              1 hour to 24 hours
Require justification:     Yes (always recommended)
Require approval:          Yes for Global Admin, Security Admin
Require MFA on activation: Yes always
Notification:              email to approvers + admin on activation

What roles should be managed in PIM?

High priority for PIM (manage ALL of these):
Global Administrator         → most powerful role in M365
Security Administrator       → manage security policies
Exchange Administrator       → access to all mailboxes
SharePoint Administrator     → access to all SharePoint data
Teams Administrator          → control Teams configuration
Compliance Administrator     → access to compliance data
Billing Administrator        → manage subscriptions and billing
User Administrator           → manage users (can reset passwords)
Privileged Role Administrator → manage PIM itself

Azure RBAC roles (also manage in PIM):
Owner (root management group)     → access to all Azure resources
Contributor (production sub)      → deploy/delete all Azure resources
User Access Administrator (prod)  → manage RBAC assignments

PIM for Azure resources:
→ PIM also works for Azure RBAC roles, not just Entra ID directory roles
→ Configure JIT access for production subscription Owner/Contributor
→ Same activation flow: eligible → activate → justification → approval

7. Scenario-Based Questions

Scenario: Design a Zero Trust identity strategy for a 5,000-person hybrid organisation.

  1. Hybrid identity: Entra Connect with Password Hash Sync + Seamless SSO. Enable password writeback. Hybrid Entra ID Join all existing domain-joined devices.

  2. MFA for everyone: Conditional Access — require MFA for all users, all cloud apps. Use Authenticator with number matching. Enable SSPR with writeback.

  3. Block legacy auth: Conditional Access — block all legacy authentication protocols. Highest-impact single action.

  4. Device compliance: Intune enrolment required. Conditional Access — require compliant device for Office 365. Unmanaged devices: browser-only.

  5. Risk-based policies (P2): Identity Protection — sign-in risk ≥ Medium: require MFA. User risk = High: require password change.

  6. PIM for all admin roles: no standing admin assignments. All admin roles eligible-only. Activation requires justification + approval + MFA.

  7. Named locations: define corporate IP ranges. Consider excluding trusted IPs from MFA requirement (risk tolerance dependent).

  8. Break-glass accounts: two cloud-only Global Admin accounts excluded from ALL CA policies. Azure Sentinel alert on any sign-in.

  9. Access Reviews (P2): quarterly review of admin roles, guest user access, and sensitive group memberships.

  10. Password Protection: deploy DC Agent to all domain controllers. Add company name and product names to custom banned list.


Scenario: A user is locked out and cannot sign in. How do you diagnose?

  1. Check sign-in logs first: Entra ID → Sign-in logs → search for user → check error code:

    50076: MFA required but not completed
    53003: Conditional Access blocked access
    50126: Invalid username or password
    50053: Account locked (smart lockout triggered)
    50057: Account disabled in Entra ID
    70011: Invalid grant / token expired
    
  2. Check account status: Entra ID → Users → find user → verify "Account enabled" toggle is ON.

  3. Check Conditional Access: if error 53003 → use "What If" tool in CA to simulate the sign-in and identify which policy blocked.

  4. Check MFA registration: user changed phone? MFA methods stale? Issue a Temporary Access Pass (TAP) for re-registration.

  5. Check Identity Protection: user risk = High? → require password reset. Sign-in risk = High? → may be blocked by risk policy.

  6. Resolution options:

    • Unlock: dismiss smart lockout from Entra ID portal
    • Reset password: admin reset or SSPR
    • Issue TAP: Temporary Access Pass for MFA bootstrap/recovery
    • Dismiss risk: in Identity Protection if confirmed false positive

Tip: Always check sign-in logs first — exact error codes explain the failure. The CA "What If" tool is invaluable for diagnosing CA-related lockouts without the user retrying.


Scenario: Onboard 500 external partner users for a 6-month project.

  1. Create an Entitlement Management access package containing all project resources — SharePoint project site, Teams team, project M365 group.

  2. Add partner's Entra ID tenant as a connected organisation — enables B2B federation with partners' own credentials.

  3. Self-service request: configure access package as requestable by connected organisation users. Partners visit myaccess.microsoft.com to request.

  4. Approval workflow: project manager approves requests. Auto-deny if no response within 7 days.

  5. Time-limited access: set access package policy to expire in 180 days. No manual cleanup — access revoked automatically at expiry.

  6. Guest Conditional Access: require MFA for all guest sign-ins. Configure cross-tenant trust to accept partner's MFA claims (avoid double-prompt).

  7. Mid-project access review: at 3 months, project manager recertifies which guests still need access. Revoke inactive guests.

  8. Offboarding: access expires automatically at 6 months. Run monthly cleanup of stale guest accounts via Access Reviews.


Scenario: Investigate a suspected account compromise.

  1. Immediate containment: Entra ID → User → Revoke sessions. Invalidates all existing tokens — forces re-authentication. Reset password immediately.

  2. Check Identity Protection: review user risk level and specific detections. Look for leaked credentials, impossible travel, anonymous IP.

  3. Review sign-in logs: look for unusual locations, legacy auth protocol usage, credential stuffing patterns (multiple failures then success), unusual hours.

  4. Review audit logs: look for:

    • New app consents granted (attacker adds persistent OAuth app)
    • New MFA methods registered (attacker adds their own phone)
    • Role assignments changed
    • New applications or credentials created
  5. Check OAuth app consents: attacker may have granted a malicious app read access to mailbox/OneDrive. Review enterprise app consents granted by the user. Revoke suspicious consents.

  6. Check mail forwarding rules: compromised accounts often have auto-forwarding rules. Check Exchange Online for forwarding rules created by the user.

  7. Remediate: once password reset and sessions revoked → dismiss user risk in Identity Protection. Monitor for 30 days.


8. Cheat Sheet — Quick Reference

Authentication Methods Priority

Most secure (phishing-resistant):
1. FIDO2 security keys (hardware)
2. Windows Hello for Business (biometric/PIN + TPM)
3. Certificate-based authentication

Strong (recommended for most users):
4. Microsoft Authenticator (push with number matching)
5. OATH TOTP (authenticator apps)

Weak (avoid or phase out):
6. SMS / Voice OTP (SIM swap vulnerable)
7. Password alone (phishing/spray vulnerable)

Emergency:
8. Temporary Access Pass (time-limited, for recovery only)

RBAC Scope Hierarchy

Management Group
  └── Subscription
       └── Resource Group
            └── Resource

Role assignment at parent scope = inherited by all children
More specific (lower scope) assignment overrides parent

Built-in roles:
Owner           = Contributor + assign RBAC
Contributor     = full resource management, NO RBAC assignment
Reader          = read-only to all resources
User Access Admin = manage RBAC only, no resource access

Entra ID Roles vs Azure RBAC

Entra ID roles (directory):          Azure RBAC roles (resources):
→ Global Administrator               → Owner
→ User Administrator                 → Contributor
→ Conditional Access Administrator   → Reader
→ Security Administrator             → Key Vault Secrets Officer
→ Application Administrator          → Storage Blob Data Contributor

These are COMPLETELY SEPARATE systems.
Global Admin ≠ Owner (no implicit Azure resource access)

Conditional Access Policy Templates

Policy 1: Require MFA for all users (most important):
  Users: All  |  Apps: All cloud apps
  Grant: Require MFA
  Exclude: Break-glass accounts

Policy 2: Block legacy authentication (highest impact):
  Users: All  |  Apps: All cloud apps
  Conditions: Client apps = Exchange ActiveSync + Other clients
  Grant: Block access

Policy 3: Require compliant device for Office 365:
  Users: All  |  Apps: Office 365
  Grant: Require device compliance (Intune)

Policy 4: Browser-only for personal devices:
  Users: All  |  Apps: SharePoint / OneDrive
  Conditions: Device state = Unregistered
  Session: App-enforced restrictions (browser only)

Policy 5: Risk-based MFA (P2):
  Sign-in risk ≥ Medium → Require MFA
  Sign-in risk = High   → Block access
  User risk = High      → Require password change

Hybrid Identity Decision

Choose Password Hash Sync (PHS) when:
→ Most organisations — simplest and most resilient
→ Want leaked credential detection (Identity Protection)
→ Want authentication to work if on-prem is unavailable
→ Migrating away from AD FS

Choose Pass-Through Authentication (PTA) when:
→ Policy prohibits any password data (even hashed) in cloud
→ Need real-time on-prem account state enforcement

Choose Federation (AD FS) when:
→ Smart card / certificate authentication required
→ Already heavily invested in AD FS infrastructure
→ Complex claims transformation needed
→ (Consider migrating away from AD FS for simplicity)

PIM Role Management

Priority roles for PIM (all should be eligible, not permanent):
Entra ID roles:
  Global Administrator, Security Administrator, Exchange Administrator,
  SharePoint Administrator, Teams Administrator, Compliance Administrator,
  User Administrator, Privileged Role Administrator

Azure RBAC roles:
  Owner (production subscription), Contributor (production),
  User Access Administrator (production)

Activation settings:
  Max duration: 1-4 hours for most admin roles
  Require justification: always
  Require approval: Global Admin, Security Admin, PRA
  Require MFA: always

Only permanent active:
  Break-glass accounts (2 maximum, excluded from all CA policies)

Top 10 Tips

  1. Entra ID ≠ Active Directory — no Kerberos, no OUs, no GPOs, no forests. Entra ID uses OAuth 2.0/OIDC for cloud apps, AD DS uses Kerberos for domain-joined machines. Know this fundamental distinction.

  2. App Registration ≠ Enterprise Application — App Reg = global app definition. Enterprise App = service principal instance in a tenant. One app registration → many service principals across tenants.

  3. Managed Identity over service principal + secret — no credential management, no rotation risk, no leakage. Always recommend for Azure-to-Azure authentication scenarios.

  4. Block legacy auth = highest single-impact security action — legacy auth (POP, IMAP, SMTP basic auth) cannot support MFA. Primary attack vector for credential stuffing. One Conditional Access policy blocks it all.

  5. PIM = no standing admin access — all admin roles should be eligible-only with JIT activation. Permanent Global Admin = massive blast radius if compromised. Always recommend PIM for any admin role discussion.

  6. Password Hash Sync is recommended over AD FS — PHS is simpler, more resilient (works if on-prem fails), and enables leaked credential detection. AD FS is complex and Microsoft recommends migrating away.

  7. Break-glass accounts are mandatory — two cloud-only Global Admins excluded from ALL CA policies. Azure Sentinel alert on any sign-in. Without them, a CA misconfiguration can lock you out permanently.

  8. Access Reviews for compliance — quarterly reviews of admin roles, guest users, and sensitive groups. Evidence for SOC 2, ISO 27001, and GDPR audits. Auto-deny on non-response is the strict-but-recommended setting.

  9. Entitlement Management for external access at scale — access packages + connected organisations = self-service B2B access with time-limits and auto-expiry. Far better than manually managing guest users.

  10. Continuous Access Evaluation (CAE) closes the token expiry window — without CAE, a disabled user's token remains valid for up to 1 hour. With CAE, revocation is near-instantaneous. Know this for any breach response scenario.



Microsoft Azure Integration Services Complete Guide

Microsoft Azure Integration Services — Complete Guide

Logic Apps · Service Bus · API Management · Event Grid · Event Hubs · Integration Patterns · Scenarios · Cheat Sheet


Table of Contents

  1. Core Concepts — Basics
  2. Azure Logic Apps — Deep Dive
  3. Azure Service Bus — Deep Dive
  4. Azure API Management — Deep Dive
  5. Integration Patterns — Event Grid & Event Hubs
  6. Scenario-Based Questions
  7. Cheat Sheet — Quick Reference

1. Core Concepts — Basics

What are Azure Integration Services?

Azure Integration Services is a suite of cloud-native services connecting applications, data, and processes across Azure, hybrid, and multi-cloud environments.

Service Purpose
Azure Logic Apps Workflow automation and orchestration — visually connect 1,000+ services
Azure Service Bus Enterprise message broker — reliable, ordered, durable messaging
Azure API Management API gateway — publish, secure, transform, monitor APIs
Azure Event Grid Event routing — react to state changes with pub/sub
Azure Event Hubs Big data streaming — high-throughput event ingestion

Tip: Focus on the "Integration Trinity" — Logic Apps + Service Bus + APIM. Know which service to use for which scenario.


Logic Apps vs Power Automate vs Azure Functions

Logic Apps:
→ Target: IT pros and developers
→ Use: enterprise integration, B2B workflows, system-to-system
→ Hosting: Consumption (serverless) or Standard (dedicated)
→ Connectors: 1,000+ managed connectors (SAP, Salesforce, Oracle)

Power Automate:
→ Target: business users (citizen automators)
→ Use: personal/team productivity, Office 365 automation
→ Hosting: Microsoft-managed SaaS (same engine as Logic Apps)

Azure Functions:
→ Target: developers
→ Use: custom code execution — C#, Python, JavaScript, PowerShell
→ No built-in connectors — write your own integration code

Combined pattern:
Logic App orchestrates workflow → calls Azure Function for complex logic

Logic Apps Consumption vs Standard

Consumption Standard
Pricing Pay per action Fixed App Service Plan
Scaling Serverless (scales to zero) Manual/auto within plan
Workflows per resource One Multiple
VNet integration Not supported Supported
Built-in connectors Managed only Free local execution
Best for Simple, variable workloads Enterprise, VNet, regulated

2. Azure Logic Apps — Deep Dive

Logic Apps Workflow Structure

Trigger → Actions → (Conditions/Loops/Scopes) → Response/Output

Common triggers:
Recurrence    → schedule (every 15 min, daily at 9am)
HTTP Request  → webhook URL (push trigger)
Service Bus   → message arrives in queue/topic
Event Grid    → Azure resource events
SharePoint    → list item created/modified
Email         → email received matching criteria

Common actions:
HTTP          → call any REST API
Service Bus   → send/receive messages
SQL/Cosmos    → database read/write
Transform XML → XSLT transformation
Parse JSON    → extract values from payload
Condition     → if/else branching
For Each      → loop over array
Scope         → group actions (error handling)
Terminate     → end workflow (success/failure/cancelled)
Response      → return HTTP response

Error Handling in Logic Apps

1. Retry policies on actions:
Default:     4 retries, exponential backoff (7.5s → 15s → 30s → 60s)
Fixed:       retry every N seconds for N attempts
Exponential: configurable base + max interval
None:        no retry

2. Scope + Run After (try/catch pattern):
Scope: "Try"
  → Action A → Action B

Scope: "Catch"
  RunAfter: "Try" has Failed OR TimedOut OR Skipped
  → Send Teams notification with error + run ID
  → Log to Application Insights
  → Terminate: Failure

3. Run After on individual actions:
Each action configurable: Succeeded | Failed | Skipped | TimedOut
Use: cleanup action that runs even if previous step fails

4. Dead-letter queue monitoring:
Messages failing max delivery → DLQ
Separate Logic App reads DLQ → sends Teams alert → manual reprocess

Tip: The Scope + Run After pattern = try/catch/finally. Every production workflow needs a Catch scope. An uncaught failure with no notification is unacceptable in production.


Logic Apps Connectors

Type Execution Cost Examples
Built-in (Standard) Local (in Logic Apps runtime) FREE HTTP, Service Bus, SQL, Functions, Recurrence
Managed standard Microsoft-managed Included Office 365, SharePoint, Teams, Azure services
Managed premium Microsoft-managed Extra cost/execution SAP, Oracle, MQ, Salesforce
Custom Microsoft-managed Managed cost Any REST/SOAP API via OpenAPI spec
On-premises Via Data Gateway Extra SQL Server on-prem, file shares, SAP

Integration Accounts and B2B

Integration Account stores B2B artefacts:
Trading partners → business entities exchanging EDI/AS2
Agreements       → AS2/EDIFACT/X12 protocol settings
Schemas (XSD)    → validate inbound/outbound messages
Maps (XSLT)      → convert one format to another
Certificates     → X.509 for AS2 signing and encryption

B2B example — EDI X12 850 Purchase Order via AS2:
1. Receive AS2 message
2. Decode AS2: verify signature, decrypt
3. Decode X12: parse EDI envelope → transactions
4. Validate against XSD schema
5. Transform X12 850 → internal JSON order (using Map)
6. Insert to SQL order management system
7. Send 997 Functional Acknowledgement back to supplier

3. Azure Service Bus — Deep Dive

Core Components

Namespace → top-level container (contoso.servicebus.windows.net)

Queue     → point-to-point messaging
           Producer → Queue → ONE consumer
           FIFO ordering within sessions
           Use: order processing, task distribution

Topic     → publish/subscribe
           Publisher → Topic → multiple Subscriptions
           Each subscription gets its own copy of every message
           SQL/Correlation rule filters per subscription
           Use: event broadcasting, multi-system notification

Subscription → logical receiver on a Topic
  Example: Topic "orders"
  → "high-value": filter WHERE amount > 10000
  → "eu-orders":  filter WHERE region = 'EU'
  → "all-orders": no filter

Message properties:
  MessageId      → unique ID (for duplicate detection)
  CorrelationId  → request-reply correlation
  SessionId      → FIFO session grouping
  TimeToLive     → message expiry
  UserProperties → custom key-value metadata

Key Service Bus Features

  1. At-least-once delivery: every message delivered at least once. Consumers MUST be idempotent.
  2. Dead-letter queue (DLQ): messages failing max delivery count preserved for analysis.
  3. Message sessions: FIFO ordering for messages with the same SessionId.
  4. Scheduled delivery: enqueue message for future availability.
  5. Duplicate detection: deduplicate by MessageId within configurable window (up to 7 days).
  6. Transactions: group multiple Service Bus operations atomically.
  7. Message deferral: set aside for later retrieval by sequence number.

Service Bus Tiers

Tier Features Use Case
Basic Queues only, 256 KB, no sessions Dev/test only
Standard + Topics, sessions, transactions, duplicate detection General integration
Premium + 100 MB messages, VNet, Availability Zones, Geo-DR, dedicated MUs Enterprise, regulated

Choose Premium when: message size > 256 KB, VNet required, compliance needs dedicated infrastructure, or high predictable throughput.


Service Bus vs Azure Storage Queues

Service Bus Storage Queues
Max message size 256 KB (Standard) / 100 MB (Premium) 64 KB
Ordering With sessions No guarantee
Dead-letter queue Yes No
Sessions/Transactions Yes No
Pub/Sub (Topics) Yes No
Cost Higher Very low
Decision:
Need ordering, DLQ, sessions, pub/sub, transactions → Service Bus
Need simple queue, massive volume, minimum cost      → Storage Queues

Competing Consumers Pattern

Service Bus Queue
  ↓ ↓ ↓
Consumer 1 | Consumer 2 | Consumer 3
(each gets a different locked message)

Message lock: prevents other consumers seeing locked messages
Lock duration: configurable (default 60s, max 5 min)

Consumer pattern:
receive message → lock acquired
  try:
    process(message)
    message.complete()    // permanently remove from queue
  catch:
    message.abandon()     // return to queue immediately
  if slow:
    message.renewLock()   // extend before lock expires

4. Azure API Management — Deep Dive

Core Components

API Gateway:
→ Receives all API calls from consumers
→ Validates keys/JWT tokens/certificates
→ Applies rate limits and quotas
→ Transforms requests/responses
→ Routes to backend services
→ Caches responses
→ Logs to Application Insights

Developer Portal:
→ Auto-generated customisable developer website
→ API documentation from OpenAPI spec
→ Interactive Try It testing
→ Self-service API key requests

APIM entities:
APIs          → imported from OpenAPI, WSDL, Functions, Logic Apps
Products      → bundle of APIs with policies (Starter, Professional, Unlimited)
Subscriptions → API key issued to access a Product
Groups        → Administrators / Developers / Guests
Backends      → target services APIM routes requests to

APIM Policies

Four policy execution points: Inbound → Backend → Outbound → On-Error

<policies>
  <inbound>
    <base />
    <!-- Rate limiting per subscription key -->
    <rate-limit calls="100" renewal-period="60" />

    <!-- JWT validation from Entra ID -->
    <validate-jwt header-name="Authorization">
      <openid-config url="https://login.microsoftonline.com/{tenantId}/v2.0/.well-known/openid-configuration" />
      <required-claims>
        <claim name="aud"><value>api://myapi</value></claim>
      </required-claims>
    </validate-jwt>

    <!-- URL rewrite -->
    <rewrite-uri template="/v2/internal/orders" />

    <!-- Add correlation ID -->
    <set-header name="X-Correlation-Id" exists-action="skip">
      <value>@(Guid.NewGuid().ToString())</value>
    </set-header>
  </inbound>

  <backend>
    <base />
    <retry count="3" interval="5" first-fast-retry="true">
      <forward-request />
    </retry>
  </backend>

  <outbound>
    <base />
    <set-header name="X-Powered-By" exists-action="delete" />
    <cache-store duration="60" />
  </outbound>

  <on-error>
    <base />
    <return-response>
      <set-status code="500" reason="Internal Server Error" />
      <set-body>{"error": "An unexpected error occurred"}</set-body>
    </return-response>
  </on-error>
</policies>

Tip: Know the most common policies: rate-limit, quota, validate-jwt, set-header, rewrite-uri, cache-lookup/cache-store, mock-response, return-response, retry, ip-filter.


APIM Tiers

Tier SLA VNet Scale Best For
Developer None No No scale Dev/test only
Basic 99.95% No 1 unit Low-traffic production
Standard 99.95% External only 4 units Moderate traffic
Premium 99.99% Internal + External 10 units/region Global, HA, regulated
Consumption 99.95% No Serverless Event-driven, variable traffic

Self-hosted gateway: deploy APIM gateway on-premises as a container — manages local APIs while config stored in cloud APIM. Use for data residency/low-latency requirements.


Products, Subscriptions, and Rate Limiting

Products: bundle APIs with access policies
  Starter:      5 calls/min, 100/day
  Professional: 50 calls/min, 10,000/day
  Unlimited:    no limits

Subscriptions: key passed as Ocp-Apim-Subscription-Key header

Rate limiting policies:
<!-- Per subscription -->
<rate-limit calls="100" renewal-period="60" />

<!-- Per IP address -->
<rate-limit-by-key calls="50" renewal-period="60"
  counter-key="@(context.Request.IpAddress)" />

<!-- Daily quota per subscription -->
<quota calls="10000" renewal-period="86400" />

Throttled response: HTTP 429 + Retry-After header

5. Integration Patterns — Event Grid & Event Hubs

Enterprise Integration Patterns

Pattern Azure Service
Message Queue (point-to-point) Service Bus Queue / Storage Queue
Publish/Subscribe (fan-out) Service Bus Topic / Event Grid
Event Streaming (high-volume) Azure Event Hubs
Orchestration (central coordinator) Logic Apps / Durable Functions
Choreography (independent reactions) Event Grid + independent services
API Gateway Azure API Management
Saga (distributed transactions) Logic Apps + Service Bus

Azure Event Grid

Event Grid: push-based pub/sub for state change events

Characteristics:
→ Push-based: events pushed to subscriber webhooks
→ Delivery: at-least-once, HTTP webhooks or Event Hubs endpoint
→ Event size: max 1 MB per event
→ Retention: 24 hours (retry with exponential backoff)
→ Throughput: up to 10 million events/second
→ Cost: pay per event

Built-in event sources:
→ Blob Storage: BlobCreated, BlobDeleted
→ Resource Groups: ResourceWriteSuccess, ResourceDeleteSuccess
→ IoT Hub: device connected/disconnected
→ Key Vault: SecretNearExpiry, SecretExpired
→ Container Registry: ImagePushed
→ Service Bus: ActiveMessagesAvailableWithNoListeners

Use Event Grid when:
→ Reacting to Azure resource state changes
→ Fan-out to many subscribers quickly
→ Serverless event-driven architecture
→ Discrete, low-frequency events

Azure Event Hubs

Event Hubs: big data streaming pipeline (Apache Kafka compatible)

Characteristics:
→ Partitioned log model
→ Throughput: millions of events/second
→ Retention: 1-7 days Standard / up to 90 days Premium
→ Consumer groups: independent readers tracking own offsets
→ Protocol: AMQP, HTTPS, Apache Kafka

Key concepts:
Partition:      ordered event sequence (ordering guaranteed within partition)
Consumer group: independent reader with own position tracking

Use Event Hubs for:
→ IoT telemetry / device readings
→ Click-stream and log analytics
→ Real-time dashboards (feed Stream Analytics / Fabric)
→ Event sourcing (replay from retained log)
→ Apache Kafka migration

Use Service Bus instead when:
→ Need DLQ and message completion acknowledgement
→ Need session-based FIFO ordering
→ Need duplicate detection and transactions
→ Processing must be reliable (order processing, finance)

Rule:
Event Hubs: streaming, analytics — events CAN be missed
Service Bus: messaging, transactions — events MUST be processed

Event Grid vs Event Hubs vs Service Bus

                   Event Grid      Event Hubs       Service Bus
Model:             Push pub/sub    Partitioned log   Pull queue/topic
Max size:          1 MB            1 MB              256 KB / 100 MB
Retention:         24 hours        1-7 days          14 days
Ordering:          No guarantee    Within partition   With sessions
DLQ:               Yes             No                 Yes
Throughput:        10M events/s    Millions/s         Thousands/s
Use for:           State changes   Streaming/analytics  Reliable messaging

6. Scenario-Based Questions

Scenario: Order processing integration between e-commerce and ERP.

  1. E-commerce → Service Bus Topic "orders": publish order JSON with properties: region, order-value, customer-tier.

  2. Topic subscriptions with filters:

    • "high-value": order-value > 5000 → approval workflow Logic App
    • "eu-orders": region = 'EU' → EU ERP Logic App
    • "us-orders": region = 'US' → US ERP Logic App
    • "all-orders": no filter → analytics/audit pipeline
  3. Logic App per subscription: receive → transform (JSON→ERP XML via Integration Account map) → call ERP API → complete message on success, abandon on failure.

  4. APIM in front: e-commerce calls single APIM endpoint. APIM abstracts backend Service Bus topology.

  5. DLQ monitoring: Azure Monitor alert on DLQ depth > 10. Operations Logic App reads DLQ, sends Teams alert.


Scenario: API gateway strategy for external partners.

  1. APIM as single entry point: all partner APIs go through APIM — backend microservices never directly exposed.
  2. Products per tier: Basic (100 calls/min, read-only), Standard (500/min, read+write), Premium (unlimited, all APIs).
  3. Security policies: validate-jwt (Entra ID tokens), ip-filter (partner IP allowlist), check-header (X-Partner-Id required).
  4. Transformation: rewrite-uri (partner-friendly → internal paths), json-to-xml (support SOAP partners).
  5. Mock responses: mock-response for APIs under development — partners integrate against contract before backend is ready.
  6. Monitoring: Application Insights — alert on error rate > 5% or P95 latency > 2s.

Scenario: Logic App is failing intermittently on external API calls.

  1. Diagnose: Logic Apps → Run history → expand failed action → inspect status code, error message, request/response body.
  2. Common fixes:
    • 429: add exponential retry (5 retries) + delay action before HTTP call
    • 408 Timeout: increase HTTP timeout, consider async callback pattern
    • 401/403: reference secrets from Key Vault, use Managed Identity
    • 400 Bad Request: log request body to Application Insights, verify dynamic expressions
  3. Configure retry policy:
    { "type": "exponential", "count": 5, "interval": "PT10S", "maximumInterval": "PT1H" }
    
  4. Add Scope + Catch block: log to Application Insights with run ID, send Teams notification.

Scenario: Migrate from BizTalk Server to Azure Integration Services.

BizTalk Azure Equivalent
Orchestrations Logic Apps workflows
Maps (XSLT) Integration Account maps
Schemas (XSD) Integration Account schemas
Trading partners / EDI Integration Account partners + agreements
MessageBox Azure Service Bus
Adapters (SQL, FTP, SAP) Logic Apps connectors
BAM Application Insights + Power BI

Strategy: strangler fig — migrate integrations one at a time. Use On-Premises Data Gateway during transition for hybrid connectivity. B2B: recreate trading partner agreements in Integration Account (AS2/EDIFACT/X12 fully supported).


7. Cheat Sheet — Quick Reference

Service Selection Guide

Need to...                                        → Use
Connect services with visual workflow              → Logic Apps
Long-running orchestration / B2B EDI              → Logic Apps + Integration Account
Reliable point-to-point message delivery           → Service Bus Queue
Pub/sub fan-out to multiple consumers              → Service Bus Topic
React to Azure resource state changes              → Event Grid
Ingest millions of telemetry/log events            → Event Hubs
Single secure entry point for all APIs             → API Management
High-volume simple queue (cheapest)                → Storage Queue
Apache Kafka workloads on Azure                    → Event Hubs (Kafka-compatible)
APIs for on-premises systems                       → APIM + Self-hosted gateway
Private/regulated integration workflows            → Logic Apps Standard + VNet

Logic Apps Quick Reference

Trigger types: Recurrence | HTTP | Service Bus | Event Grid | Storage | Email
Error handling: Retry policy + Scope (try/catch) + Run After settings
Connectors:    Built-in (free in Standard) | Managed Standard | Premium | Custom
B2B:           Integration Account (maps, schemas, partners, agreements)
Development:   VS Code + Azure Logic Apps extension (Standard)
Monitoring:    Run history + Application Insights

Service Bus Quick Reference

Tiers: Basic (queues only) | Standard (+ topics) | Premium (+ VNet, 100MB msgs)
At-least-once delivery → consumers must be idempotent
DLQ → failed messages preserved, requires separate monitoring
Sessions → FIFO ordering by SessionId
Duplicate detection → deduplication by MessageId (up to 7 days)
Transactions → atomic multi-operation groups

Message operations:
complete()    → successfully processed, remove permanently
abandon()     → return to queue (retry)
defer()       → set aside for later (retrieve by sequence number)
renewLock()   → extend lock for slow processing
dead-letter() → explicitly move to DLQ

APIM Policy Reference

Inbound:    rate-limit, quota, validate-jwt, ip-filter, check-header,
            rewrite-uri, set-header, cache-lookup, mock-response
Backend:    retry, forward-request, set-backend-service
Outbound:   cache-store, set-header, json-to-xml, find-and-replace
On-Error:   return-response, set-status, set-body

Policy scope hierarchy (most → least specific):
Operation > API > Product > Global
<base /> inherits from parent scope

Top 10 Tips

  1. Know when to use each service — Logic Apps = orchestration. Service Bus = reliable messaging. APIM = API gateway. Event Grid = event routing. Event Hubs = streaming. Mixing these up is an immediate red flag.

  2. Standard Logic Apps for enterprise — if the question involves private networks, regulated environments, or multiple related workflows, always recommend Standard over Consumption.

  3. At-least-once delivery = idempotent consumers — Service Bus guarantees delivery but not exactly-once processing. Always state this constraint when discussing Service Bus consumer design.

  4. APIM policy execution order — Inbound → Backend → Outbound → On-Error. Know which policies go in which section. validate-jwt in Inbound. cache-store in Outbound. This order is always tested.

  5. Service Bus Premium for VNet and large messages — Standard cannot join a VNet. Premium supports 100 MB messages and private endpoints. Know when to recommend Premium.

  6. DLQ needs monitoring — DLQ is not a black hole. Design a monitoring alert + reprocessing workflow for every Service Bus queue/topic in production.

  7. Event Grid for discrete state changes, Event Hubs for streaming — Grid delivers individual events (blob created, resource changed). Hubs ingests continuous high-volume streams. Never confuse these.

  8. Mock responses enable contract-first development — APIM mock-response lets partners integrate before the backend exists. A sign of mature API design.

  9. Scope + Run After = try/catch in Logic Apps — every production Logic App needs a Catch scope. Demonstrate this in any Logic Apps design question.

  10. Know the BizTalk migration mapping — orchestrations → Logic Apps, MessageBox → Service Bus, maps → Integration Account maps, adapters → connectors. This is a senior staple for Microsoft enterprise integration roles.



Featured Post

Pin a SharePoint Site to the Microsoft Teams Left Rail (No Code)

This is a no-code, step-by-step guide. You package a SharePoint page as a Teams app, upload it, and pin it for everyone in your organisation...

Popular posts