Join our Newsletter — 33% off our NHI Course
Home› Guides› IdP configuration backup and restore for Entra ID…
Guide Resilience & Recovery

IdP configuration backup and restore for Entra ID and Okta: export, version and recover tenant settings

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 28 October 2026 13 min read
On this page

Most organisations back up their file servers nightly but cannot say what their Conditional Access policies or Okta sign-on rules looked like last Tuesday. When an administrator, a faulty script or an attacker changes identity provider configuration, every application behind it changes with it, and neither Microsoft Entra ID nor Okta keeps a long history you can roll back to. This guide covers what each platform can recover natively, what it cannot, and how to build a versioned configuration backup with Microsoft Entra Backup and Recovery, the Microsoft Entra Exporter, Microsoft Graph and the Okta Terraform provider. It is written for identity engineers and resilience owners who need a tested restore path, not just an export job.

Key takeaways

  • Native recovery windows are short. Entra soft delete keeps users, groups, applications and service principals for 30 days, and Entra Backup and Recovery keeps seven days of daily backups; a deleted Okta user cannot be restored at all.
  • Configuration and objects need different backups. Policies, named locations, authentication method settings and app configuration change in place, so you need a known-good copy outside the tenant to compare against and reapply.
  • Exports are not restores. The Entra Exporter only exports; Okta Terraform can reapply, but only for object types you have imported and manage consistently through it.
  • Secrets never come back. Client secrets, certificates and key credentials are outside Entra Backup and Recovery scope, so any restore of an application is followed by a credential reissue.
  • The backup pipeline is itself a privileged identity. A read-everything Graph app or Okta service app with manage scopes is a high-value non-human identity: least privilege, key storage and monitoring apply.

What each platform can recover natively

Platform featureWhat it coversWindowGap you must close
Entra soft delete (recycle bin)Users, Microsoft 365 Groups, cloud security groups, application registrations, service principals, administrative units; Microsoft's recovery guidance also lists Conditional Access policies and named locations as keeping all properties when soft deleted30 days, then hard deletedAll other object types are hard deleted immediately and must be re-created
Microsoft Entra Backup and RecoverySupported properties of users, groups, applications, service principals; all properties of Conditional Access and named location policies; authentication methods policy; parts of the authorization policy; admin-consented OAuth2 grants and app role assignments with their service principalDaily backups, seven days retainedWorkforce tenants with Entra ID P1 or P2 only; no credentials, no group ownership, manager or sponsor links, no dynamic group rules, no user-consented grants
Tenant configuration management (TCM) snapshotsA subset of Entra resources and properties, plus other workloads such as Intune and Exchange OnlineSnapshots stored seven daysDownload for external retention; keep separate from Graph exports, as Microsoft advises
Okta user deactivationDeactivated users keep group memberships; reactivation may need app reassignmentUntil deletedDeletion "can't be undone"; app assignments are removed on deactivation
Okta configurationNo native configuration snapshot appears in the Okta documentation reviewed for this guideNoneTerraform state and configuration, or API exports, are the backup

Entra Backup and Recovery backups cannot be turned off, deleted or modified by any user or application, including the highest admin roles, which makes them a useful tamper-resistant layer against a compromised Global Administrator. Recovery applies to supported properties only and does not roll back whole objects. The wider Entra and Active Directory recovery sequence, including forest recovery and hybrid ordering, is in the Identity Recovery Guide.

What to back up and why

ConfigurationEntra ID sourceOkta sourceImpact if lost or changed
Access policiesConditional Access policies and named locations (Graph conditionalAccessPolicy API)Global session, authentication and app sign-on policies and rules; network zonesAccess opened to everyone, or administrators locked out
Authentication methodsAuthentication methods policyAuthenticators and enrolment policiesWeaker methods allowed, or users unable to sign in
Federation and trustDomain federation settings, cross-tenant access settingsIdentity providers (inbound federation)Forged or unintended inbound access (ATT&CK T1484.002 Trust Modification)
ApplicationsApp registrations, service principals, permissions and consent grantsApp integrations, assignments, OAuth and SAML settingsSingle sign-on broken across dependent apps
Roles and delegationCustom role definitions, PIM settings, administrative unitsCustom admin roles and resource setsPrivilege wider or narrower than intended
Groups that drive accessSecurity groups, dynamic membership rulesGroups and group rulesMass loss or gain of app access
Tenant-wide settingsExternal identities, self-service password reset, user settingsOrg general settings (imported as singletons)Behaviour changes for every user

Do not try to back up every user object as configuration. Okta explicitly advises against importing users into Terraform because user objects, with memberships and assignments, are large. Users belong to your HR or directory source of truth; groups, policies and apps belong to configuration backup.

Building the Entra ID backup

  1. Turn on the native layer (read-only to review): confirm the tenant is licensed for Entra ID P1 or P2 and open Entra Backup and Recovery. Assign Microsoft Entra Backup Reader to the people who review backups and Microsoft Entra Backup Administrator through PIM to the small team that runs recoveries.
  2. Create the export identity: a dedicated identity for the Entra Exporter with read scopes only, such as Directory.Read.All, Policy.Read.All, Application.Read.All and RoleManagement.Read.All. Microsoft notes delegated authentication in a pipeline needs a dedicated agent with pre-configured authentication.
  3. Export nightly: Install-Module EntraExporter, Connect-EntraExporter, then Export-Entra -Path 'C:\EntraBackup\'. The default Config type covers Conditional Access, named locations, authentication methods, roles and many settings. Add -Type "Applications","ServicePrincipals" or use -All for wider coverage. PowerShell 7 is recommended and long Windows paths must be enabled.
  4. Commit to version control: push the JSON to a repository in a separate security boundary with restricted write access and branch protection. Each night's diff becomes your change history.
  5. Keep TCM snapshots separate: if you also download TCM snapshots, store them in a different path. Microsoft advises not combining them with Graph exports because TCM covers only a supported subset.
  6. Document what exports miss: anything not exposed in Microsoft Graph is not exported. Record those settings manually as part of the change process.

Building the Okta backup

  1. Create the Terraform service app: in the Admin Console create an API Services app integration, use public key and private key client authentication, and keep the PKCS#1 private key in a secrets manager. Okta recommends OAuth over API tokens because API tokens inherit the creating admin's permissions and are valid for 30 days, renewing each time they are used.
  2. Grant least privilege: assign a custom admin role for production rather than Super Administrator, and grant only the Okta API scopes Terraform needs (for example okta.groups.read for a read-only export, okta.groups.manage for restore). Granting scopes needs a Super Administrator.
  3. Import existing configuration (read-only against Okta): with Terraform 1.8.5 or later, add import blocks for policies, rules, network zones, groups, group rules and app integrations, then run terraform plan -generate-config-out=generated_resources.tf. Policy rule and network IDs must come from the REST API, not the Admin Console URL. Org-wide singletons use the ID singleton. Okta feature settings cannot be imported.
  4. Converge to zero drift: run terraform plan until it reports no changes. Only then is the configuration a faithful backup.
  5. Protect state: Okta recommends remote state, versioned and encrypted. Treat state as sensitive, because it holds the full current configuration.
  6. Pick one owner per object type: Okta recommends managing each object type through Terraform or the Admin Console, not both. Mixed management means the next apply silently reverts an emergency console fix.

Restoring: a tested sequence

Restores change live access for every user, so the first steps are read-only and the destructive ones are marked.

  1. Secure admin access first: confirm a break-glass account works and is excluded from the policies you may change. See the Break-Glass Account Guide.
  2. Establish what changed (read-only): in Entra, run a difference report in Backup and Recovery and read the audit log entries, which show old and new values. In Okta, run terraform plan against the last known-good commit; the plan is the difference report.
  3. Decide the restore path: soft-deleted object within 30 days: restore from the recycle bin or the Graph deletedItems restore API. Changed supported property within seven days: Entra Backup and Recovery job. Older change or unsupported property: reapply from the exported JSON. Okta: terraform apply of the known-good commit.
  4. Restore dependencies before policies: groups and service principals that a Conditional Access policy or Okta rule targets must exist first. Restoring a policy without its exclusion group can lock out administrators.
  5. Apply in a narrow scope first: recover selected object IDs rather than the whole tenant, or apply one Terraform resource with -target. Destructive: each apply overwrites live configuration and takes effect immediately.
  6. Reissue credentials: re-created applications have no secrets or certificates; issue new ones and update the consuming workloads. A deleted Okta user must be re-created and re-enrolled.
  7. Verify: re-run the difference report or plan until clean, test sign-in for a sample of users and apps, and record the incident.

Roll back a bad restore the same way: the previous night's export or commit is itself a restore point. That is why the backup must be taken before the change window, not after it.

Choosing an approach

SituationRecommended approachTrade-off
Small Entra tenant, few adminsNative Backup and Recovery plus nightly Entra Exporter to a private repositoryRestores beyond seven days are manual reapplication
Large Entra tenant with change controlPolicy-as-code for Conditional Access through Graph, Exporter for everything else, TCM snapshots for multi-workload coverageEngineering effort; pipeline identity needs careful scoping
Okta org managed in the consoleTerraform import with generated config as a read-only backup, applied only in recoveryDrift grows unless plan runs nightly and differences are reviewed
Okta org managed fully as codeTerraform as source of truth, console changes prohibited for managed typesEmergency changes must also go through the pipeline
Third-party SaaS backup productEvaluate coverage per object type against the tables aboveAnother privileged integration to govern; see the SaaS Backup Buyer's Guide

Detection and measurement

  • Entra audit log: watch Add, Update and Delete activities on Conditional Access policies and named locations, authentication methods policy updates, role definition changes, cross-tenant access settings and "Set federation settings on domain". Microsoft notes "Delete group" does not reveal group type, so pair it with your export. The Sensitive operations report workbook flags credential and federation changes. See the Entra ID Sign-In and Audit Log Detection Guide.
  • Okta System Log: alert on policy.lifecycle.update, policy.rule.update and policy.rule.deactivate, system.idp.lifecycle.create and system.api_token.create, and any change made by an actor other than the Terraform service app for Terraform-managed types. See the Okta System Log Detection Guide.
  • Nightly drift: a non-empty Git diff or Terraform plan with no matching change ticket is an alert, not just a report.

Metrics:

  • Days since the last successful export and last successful restore test, per IdP.
  • Percentage of critical configuration types (from the table above) covered by a backup.
  • Unticketed configuration changes found by drift detection per month.
  • Time to restore a deleted Conditional Access policy or Okta sign-on rule in the last test.
  • Number of identities holding restore rights (Backup Administrator, Terraform manage scopes).

Common failure patterns

  • Exporting without ever restoring: the JSON exists, but nobody has turned it back into a working policy, and the first attempt is during an incident.
  • Backup stored in the same blast radius: the repository is writable by the same admin accounts that could be compromised, so an attacker edits history as well as the tenant.
  • Over-privileged pipeline identity: the export app holds write scopes or Super Administrator because it was easier, creating a standing path to change every policy. Okta API tokens inherit the creator's rights and renew on use, which makes them a poor choice here.
  • Restoring the policy before its groups: a Conditional Access policy comes back referencing a deleted exclusion group and blocks the admins doing the restore.
  • Mixed console and Terraform management in Okta: an emergency console fix is reverted by the next scheduled apply.
  • Forgetting credentials: applications are restored but their secrets are not, and integrations fail hours later.

Where identity fits

The export identity and the restore identity are among the most privileged non-human identities in the estate: one can read every policy, the other can rewrite them. Use separate identities for export (read-only) and restore (write, held in PIM or activated only in recovery), store Okta private keys and Entra certificates in a secrets manager, and review both in access reviews. The isolation principles match those in the Backup Identity Isolation Guide, and Okta service app review is covered in How to audit Okta API tokens and service apps.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5CP-9 System Backup; CP-10 System Recovery and ReconstitutionConfiguration exports and tested restore sequence
NIST SP 800-53 Rev 5CM-2 Baseline Configuration; CM-3 Configuration Change Control; CM-6 Configuration SettingsKnown-good state in version control, drift detection
NIST CSF 2.0PR.DS-11; PR.PS-01; RC.RP-03; RC.RP-05Backups tested, configuration managed, integrity verified before and after restore
MITRE ATT&CK v20T1484 Domain or Tenant Policy Modification; T1484.002 Trust Modification; T1531 Account Access RemovalMalicious policy or federation changes and lockout that the backup must undo

Practitioner checklist

  • Confirm Entra Backup and Recovery is available and assign Backup Reader and Backup Administrator (through PIM) deliberately.
  • Run the Entra Exporter nightly with a read-only identity into a protected, versioned repository.
  • Import Okta policies, rules, zones, groups, group rules and apps into Terraform and converge the plan to zero changes.
  • Authenticate Terraform with an OAuth service app, private key in a secrets manager, custom admin role and minimal scopes.
  • Store Terraform state remotely, encrypted and versioned.
  • Document configuration that exports cannot capture.
  • Test a restore of one Conditional Access policy and one Okta sign-on rule each quarter, including dependent groups.
  • Alert on unticketed drift and on configuration changes made outside the pipeline.
  • Include credential reissue in every application restore runbook.

Standards and references

Related NHI Mgmt Group resources: Identity Recovery Guide · Emergency Identity Operations When the Primary IdP Is Unavailable · Okta Security Hardening Guide · Backup Identity Isolation Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 28 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.