authentik.sources.oauth.migrations.0014_migrate_azuread_to_entraid

 1# Generated by Django 5.2.14 on 2026-05-09 19:01
 2
 3from django.db import migrations
 4
 5
 6def migrate_azuread_to_entraid(apps, schema_editor):
 7    OAuthSource = apps.get_model("authentik_sources_oauth", "OAuthSource")
 8
 9    db_alias = schema_editor.connection.alias
10    OAuthSource.objects.using(db_alias).filter(provider_type="azuread").update(
11        provider_type="entraid"
12    )
13
14
15class Migration(migrations.Migration):
16
17    dependencies = [
18        ("authentik_sources_oauth", "0013_useroauthsourceconnection_refresh_token"),
19    ]
20
21    operations = [
22        migrations.RunPython(migrate_azuread_to_entraid, migrations.RunPython.noop),
23    ]
def migrate_azuread_to_entraid(apps, schema_editor):
 7def migrate_azuread_to_entraid(apps, schema_editor):
 8    OAuthSource = apps.get_model("authentik_sources_oauth", "OAuthSource")
 9
10    db_alias = schema_editor.connection.alias
11    OAuthSource.objects.using(db_alias).filter(provider_type="azuread").update(
12        provider_type="entraid"
13    )
class Migration(django.db.migrations.migration.Migration):
16class Migration(migrations.Migration):
17
18    dependencies = [
19        ("authentik_sources_oauth", "0013_useroauthsourceconnection_refresh_token"),
20    ]
21
22    operations = [
23        migrations.RunPython(migrate_azuread_to_entraid, migrations.RunPython.noop),
24    ]

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

dependencies = [('authentik_sources_oauth', '0013_useroauthsourceconnection_refresh_token')]
operations = [<RunPython <function migrate_azuread_to_entraid>, <function RunPython.noop>>]