I'm trying to delete an custom extension which i created for emailotp

Vikram 0 Reputation points
2025-08-13T02:40:56.4866667+00:00

I'm trying to delete an custom authentication extension which i created for email otp.

I have seen similar issues raised by others for deleting custom authentication extension for attribute collection, unlinking it from user flows worked but in this case there is no option to link or unlink the email otp extension, i couldnt find it under userflows nor in custom auth extension.

Help me in deleting this.

Below is the error message i received.
Cannot delete custom extension xxxxxxx-dc55-4595-bb81-2376317fcaa6: The custom extension is in used by the listener of id 01565c76-7216-42fd-96d2-xxxxxxxxx

Custom extension id is understandable, but not sure what is the listener of id refers to.

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,996 Reputation points Microsoft Employee
    2026-03-24T09:53:33.0433333+00:00

    Looks like the delete operation is refusing because the resource is being used. Here is how to try and resolve the issue. Use Graph API or Powershell

    1. Check Dependency on Azure AD Authentication Policies

    • Browse to Azure AD B2C bladein the Azure Portal.
    • Navigate to Custom Authentication Extensionsunder Security > Authentication Methods.
    • Look for any references to the custom extension you are trying to delete. If it's bound to any authentication method or policy here, you must remove it.

    2. Identify the Listener

    • The listener ID 01565c76-7216-42fd-96d2-xxxxxxxxx in the error message indicates an associated entity. To identify what or where this listener is:
      • Use Microsoft Graph Exploreror PowerShell/Microsoft Graph APIsto query your tenant. Specifically, run a query against the authenticationMethodsPolicy endpoint to detect where the extension is attached.

    Example Using Microsoft Graph API:

    GET https://graph.microsoft.com/v1.0/policies/authenticationMethodsPolicy
    Authorization: Bearer <Access_Token>
     
     
    
    • Look in the response for any reference to 01565c76-7216-42fd-96d2-xxxxxxxxx or details of bindings that use your custom extension.
    • Once you've located the policy, feature, or configuration that is associated with the custom extension, unlink or delete it.
    • Depending on the result:
      • If the listener is part of a group, policy, or a service principal, update the properties using the respective Azure AD blade.
        • If it's an API-level setting or something bound through Microsoft Graph, update or delete it using the Graph API.

    4. Attempt to Delete the Custom Extension Again

    • After clearing all dependencies, try deleting the custom extension:
      • Go back to Azure AD B2C > Security > Custom Authentication Extensions.
      • Locate the custom extension you want to delete and click Delete

    Example PowerShell Command (To Check All Dependencies)

    Run the following script using the AzureAD module in PowerShell:

    
    Install-Module AzureAD
    Connect-AzureAD
    
    # Replace with your extension ID
    $extensionId = "xxxxxxx-dc55-4595-bb81-2376317fcaa6"
    
    # Search all service configs for mentions of the extension
    Get-AzureADServicePrincipal | Where-Object { ($_ | ConvertTo-Json -Depth 10) -match $extensionId }
     
     
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.