diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
index 31cfc25cc5..aaca7788da 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
@@ -231,6 +231,10 @@ public function query() {
     if (!empty($this->configuration['bundle'])) {
       $query->condition($this->entityType->getKey('bundle'), $this->configuration['bundle']);
     }
+    // Exclude anonymous user account.
+    if ($this->entityType->id() === 'user' && !empty($this->entityType->getKey('id'))) {
+      $query->condition($this->entityType->getKey('id'), 0, '>');
+    }
     return $query;
   }
 
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php
index 8ed7ef5942..43a72dae91 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php
@@ -150,6 +150,12 @@ protected function setUp(): void {
     ]);
     $this->user->save();
 
+    $this->anon = User::create([
+      'name' => 'anon',
+      'uid' => 0,
+    ]);
+    $this->anon->save();
+
     $term = Term::create([
       'vid' => $this->vocabulary,
       'name' => 'Apples',
@@ -273,6 +279,7 @@ public function testUserSource(array $configuration) {
     $user_source = $migration->getSourcePlugin();
     $this->assertSame('users', $user_source->__toString());
     if (!$configuration['include_translations']) {
+      // Confirm that the query does not return a row for the anonymous user.
       $this->assertEquals(1, $user_source->count());
     }
     $this->assertIds($user_source, $configuration);
