azureazure-active-directoryazure-ad-b2cazure-cliazure-cli2

Azure cli or rest api end to upload custom policy


I am trying to automate the upload of custom policies as I have multiple tenants and each tenant consists of multiple custom policies. I am interested in either Azure cli or SDK for the same. I searched on Google but could not find anything related.

Anyone work on this kind of automation?


Solution

  • Local/Manual deployment options:

    1. PowerShell Script again the Trust Framework Policy Graph API, Azure AD PowerShell module, or using the Microsoft.Graph.Beta PowerShell SDK - You would need to handle variable substitution before uploading the policies.

    2. Using VSCode, use the Azure AD B2C Tools extension, which allows adding multiple environments. Variable substitution is handled by the package.

    CI/CD Pipeline:

    1. Azure DevOps pipeline - You would need to handle variable substitution in the pipeline. Azure DevOps pipeline for Azure AD B2C Sample

    2. GitHub Actions pipeline - You would need to handle variable substitution in the pipeline. Github Action for Azure AD B2C using ieftool Sample

    3. IEF Tool npm package - You would need to handle variable substitution in the pipeline. Sample below for Azure DevOps Pipeline

    - task: NodeTool@0
      displayName: 'Install Node'
      inputs:
        versionSpec: '10.x'
    
    - script: npm install -g ieftool
      displayName: 'Install IEF Tool'
    
    - script: ieftool deploy -t $(TenantId) -c $(DeploymentClientId) -s $(DeploymentClientSecret) -p $(Pipeline.Workspace)/b2c-policies
      displayName: 'Uploading IEF policies'