- Tenant Anatomy: Understand the relationship between your Entra ID directory (`TenantId`), initial `*.onmicrosoft.com` fallback domain, and verified custom domains.
- Production DNS Blueprint: Configure the 6 non-negotiable DNS records (TXT verification, MX, SPF, Autodiscover, DKIM CNAMEs, and DMARC) cleanly on Day 1.
- Modern Licensing Architecture: Avoid direct per-user license clicks—design **Group-Based Licensing** from day one so onboarding and Intune/Exchange provisioning stay automated.
- Hands-On Lab: Audit your tenant's organization profile, verified domains, and subscribed SKUs using Microsoft Graph PowerShell v2 (live-tested on the LAB 365 tenant).
Every reliable Microsoft 365, Exchange Online, and Intune deployment starts with a clean foundation. Most messy enterprise tenants—broken hybrid routing, unverified parked domains getting spoofed, orphaned licenses, and inconsistent UPNs—trace directly back to shortcuts taken during Day 1 tenant setup.
In Chapter 1 of our 14-chapter hands-on book series, we establish the exact architecture of a production Microsoft 365 tenant, walk through custom domain and DNS verification, and build your first live Microsoft Graph PowerShell tenant inventory script.
1. Anatomy of a Microsoft 365 Tenant
When Microsoft provisions your tenant, it creates a dedicated Microsoft Entra ID directory with three permanent anchors:
- Tenant ID (GUID): A globally unique identifier (e.g.,
ab85c7a1-366d-44ba-acc6-924fa0950045). You will use this in every Graph API call, Intune enrollment profile, and Certificate-Based Authentication script. - Initial Domain (
<tenant>.onmicrosoft.com): Your permanent fallback namespace. Never delete or break routing on this domain—it is used for break-glass Global Administrator accounts and Exchange Hybrid mail routing (<tenant>.mail.onmicrosoft.com). - Verified Custom Domains (
contoso.com): Your corporate identity and email domains. Always set your primary corporate domain as Default so newly created users automatically receive[email protected]instead of[email protected].
2. The 6 Non-Negotiable DNS Records for Production Domains
Before migrating a single user, ensure your external DNS zone (Cloudflare, Route 53, Azure DNS, etc.) includes all six records:
| Record Type | Host / Name | Purpose | Enterprise Best Practice |
|---|---|---|---|
| TXT | @ | Domain ownership verification (MS=msXXXXXXXX) | Keep in DNS after verification so re-verification audits pass. |
| MX | @ | Routes inbound internet email to Exchange Online | Point to <domain>.mail.protection.outlook.com (Priority 0). |
| TXT (SPF) | @ | Authorizes Exchange Online to send mail | v=spf1 include:spf.protection.outlook.com -all (use -all hard fail once all third-party senders are inventoried). |
| CNAME | autodiscover | Auto-configures Outlook & mobile clients | Points to autodiscover.outlook.com. |
| CNAME (DKIM) | selector1._domainkey & selector2._domainkey | Cryptographically signs outbound mail | Enable DKIM in Defender portal for every custom domain (even parked domains!). |
| TXT (DMARC) | _dmarc | Tells receivers how to handle spoofed mail | Start at p=none; rua=mailto:dmarc@... then tighten to p=quarantine / p=reject. |
Deep Dive: Once you finish Chapter 1, bookmark our PowerShell SPF/DKIM/DMARC Tenant-Wide Audit Script to verify every domain in your tenant automatically.
3. Hands-On Lab 1: Audit Your Tenant with Microsoft Graph PowerShell
Legacy Microsoft 365 tutorials used Connect-MsolService (Get-MsolDomain, Get-MsolAccountSku). Those modules are retired. Every script in this book uses Microsoft Graph PowerShell SDK v2 on PowerShell 7.
<#
.SYNOPSIS
Chapter1-TenantFoundationAudit.ps1
Live-tested on the LAB 365 Dev Tenant using Microsoft Graph SDK v2.
#>
# 1. Install the core Graph modules (first time only)
# Install-Module Microsoft.Graph.Identity.DirectoryManagement -Scope CurrentUser
# 2. Connect with least-privilege read scopes
Connect-MgGraph -Scopes "Organization.Read.All", "Domain.Read.All" -NoWelcome
Write-Host "=== 1. Tenant Organization Summary ===" -ForegroundColor Cyan
Get-MgOrganization |
Select-Object DisplayName, Id, TenantType, CreatedDateTime |
Format-Table -AutoSize
Write-Host "=== 2. Verified & Unverified Domains ===" -ForegroundColor Cyan
Get-MgDomain |
Select-Object Id, IsDefault, IsVerified, AuthenticationType |
Sort-Object IsDefault -Descending |
Format-Table -AutoSize
Write-Host "=== 3. Subscribed License SKUs ===" -ForegroundColor Cyan
Get-MgSubscribedSku |
Select-Object SkuPartNumber, CapabilityStatus, ConsumedUnits,
@{Name = "Enabled"; Expression = { $_.PrepaidUnits.Enabled } },
@{Name = "Remaining"; Expression = { $_.PrepaidUnits.Enabled $_.ConsumedUnits } } |
Format-Table -AutoSize
Verified Live Output from the LAB 365 Dev Tenant:
=== 1. Tenant Organization Summary ===
DisplayName Id TenantType CreatedDateTime
----------- -- ---------- ---------------
LAB 365 ab85c7a1-366d-44ba-acc6-924fa0950045 AAD 2023-03-30T13:47:39Z
=== 2. Verified & Unverified Domains ===
Id IsDefault IsVerified AuthenticationType
-- --------- ---------- ------------------
lab365.in True True Managed
xzf58.onmicrosoft.com False True Managed
xzf58.mail.onmicrosoft.com False True Managed
rnd.lab365.in False True Managed
caa.lab365.in False True Managed
svc.lab365.in False True Managed
microsoftupdates.co.in False True Managed
=== 3. Subscribed License SKUs ===
SkuPartNumber CapabilityStatus ConsumedUnits Enabled Remaining
------------- ---------------- ------------- ------- ---------
FLOW_FREE Enabled 5 10000 9995
DEVELOPERPACK_E5 Enabled 25 25 0
4. Day-1 Best Practice: Group-Based Licensing Over Direct Assignment
Never assign licenses manually to individual users. Instead:
- Create Entra ID security groups per persona (e.g.,
LIC-M365-E5-KnowledgeWorkers,LIC-M365-F3-Frontline,LIC-Intune-Plan1). - Attach the SKU (and disable unwanted sub-service plans like legacy Sway or Viva Engage if desired) to the group in Entra Admin Center → Billing → Licenses.
- When HR onboards a user into the group, Entra ID automatically provisions their Exchange Online mailbox, Teams account, OneDrive, and Microsoft Intune entitlement—and reclaims the license automatically when they leave.
5. Chapter 1 Lab Exercise & What's Next
Complete This Checklist Before Chapter 2:
- [ ] Run
Chapter1-TenantFoundationAudit.ps1and save your baseline domain and SKU inventory. - [ ] Confirm your primary corporate domain is marked
IsDefault = TrueandIsVerified = True. - [ ] Create two break-glass cloud-only Global Administrator accounts on
*.onmicrosoft.comprotected with FIDO2 hardware keys (covered in depth in Chapter 3). - [ ] Check whether any unused/parked domains in your tenant lack
v=spf1 -allandv=DMARC1; p=reject;records.
Up Next in This Book:
- Chapter 2: Microsoft Entra ID Identity Lifecycle: Users, Security Groups, Dynamic Rules & Administrative Units (Coming next in the Learning Hub!).