Giter Club home page Giter Club logo

deploy-trustframework-policy's Introduction

GitHub Action for deploying Azure AD B2C custom policies

Use this GitHub Action to deploy an Azure AD B2C custom policy into your Azure Active Directory B2C tenant using the Microsoft Graph API. If the policy does not yet exist, it will be created. If the policy already exists, it will be replaced.

For more information, see Deploy Azure AD B2C custom policy with GitHub actions.

Sample workflow to deploy custom policies

on: push

env:
  clientId: 00000000-0000-0000-0000-000000000000
  tenant: my-tenant.onmicrosoft.com

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: 'Upload TrustFrameworkBase Policy'
      uses: azure-ad-b2c/deploy-trustframework-policy@v5
      with:
        folder: "./Policies"
        files: "TrustFrameworkBase.xml,TrustFrameworkExtensions.xml,SignUpOrSignin.xml"
        tenant: ${{ env.tenant }}
        clientId: ${{ env.clientId }}
        clientSecret: ${{ secrets.clientSecret }}
        renumberSteps: false

Developer notes

To update new version you must package this GitHub Action. Use the following commands to package the project:

npm run-script build  
npm run-script package

You can find more information about these scripts in the package.json file. For example:

"scripts": {
    "build": "tsc",
    "format": "prettier --write **/*.ts",
    "format-check": "prettier --check **/*.ts",
    "lint": "eslint src/**/*.ts",
    "package": "ncc build --source-map --license licenses.txt",
    "test": "jest",
    "all": "npm run build && npm run format && npm run lint && npm run package && npm test"
  }

After the build is completed, you can see that the JavaScript files under the dist folder changed with the latest version of your TypeScript code.

Build issues

The GitHub build runs the scrips as described above. The lint script runs the eslint command. This command analyzes your code to quickly find problems. You can change the settings of the eslint command in the .eslintrc.json file. The following example suppresses some of the errors:

"rules": {
    "i18n-text/no-en": 0,
    "import/named": "warn",
    "github/no-then": "warn",
    "eslint-comments/no-use": "off",
    "import/no-namespace": "off",
    "no-unused-vars": "off",

Test the action

When you commit a change to any branch or a PR, the test.yml workflow runs with clientId parameter set to test. The test value indicates to the GitHub Action to exit the test successfully. We exit the test because because the required parameters are not configured in this repo.

To test the GitHub Action create your own repo, add the workflow. Then configure the uses to point to your branch, fork, or commit. The following example demonstrate how to configure the workflow to use the latest commit in the vNext branch.

- name: 'Upload custom policies'
  uses: azure-ad-b2c/deploy-trustframework-policy@vNext

Community Help and Support

Use Stack Overflow to get support from the community. Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before. Make sure that your questions or comments are tagged with [azure-ad-b2c].

If you find a bug in the sample, please raise the issue on GitHub Issues.

To provide product feedback, visit the Azure AD B2C feedback page.

deploy-trustframework-policy's People

Contributors

adamstoffel avatar dependabot[bot] avatar yoelhor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploy-trustframework-policy's Issues

Not sure why the endpoint is wrong? "No action was found on the controller 'trustframework' that matches the request"

Trying to use GitHub actions to deploy policies but getting "Error: {"message":"No HTTP resource was found that matches the request URI 'https://cpim.windows.net/graph/trustFramework/policies'.","messageDetail":"No action was found on the controller 'trustframework' that matches the request.","stackTrace":null}" error. From what I can see it seems like the correct URL is https://graph.microsoft.com/beta/trustFrameworkPolicies. Where do I change it? Should I even?

Can a federated identity be used for authentication?

is it possible to use a federated identity for authentication?

on: push

env:
  clientId: 00000000-0000-0000-0000-000000000000
  tenantId: 11111111-1111-1111-1111-111111111111
  subscriptionId: 22222222-2222-2222-2222-222222222222
  tenant: my-tenant.onmicrosoft.com

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    # azure creds using oidc
    - name: 'Az CLI login'
      uses: azure/login@v1
      with:
        client-id: ${{ env.clientId }}
        tenant-id: ${{ env.tenantId }}
        subscription-id: ${{ env.subscriptionId }}
    - name: 'Upload TrustFrameworkBase Policy'
      uses: azure-ad-b2c/deploy-trustframework-policy@v5
      with:
        folder: "./Policies"
        files: "TrustFrameworkBase.xml,TrustFrameworkExtensions.xml,SignUpOrSignin.xml"
        tenant: ${{ env.tenant }}
        clientId: ${{ env.clientId }}
        renumberSteps: false

something like this

Action failed: Unauthenticated

We are uploading up to 13 policies and action randomly fails with error "Action failed: Unauthenticated" after uploading up to 5 policies.

We keep re0run jobs again and it's eventually works

Deploy failed without error details

We are using azure-ad-b2c/deploy-trustframework-policy@v1 and it worked fine.
After some recent changes (changing secret ) deployment start to fail without error details

Error: Action failed: [object Object].
How can I see exception details?

Similar deployment to other B2C AAD continue to work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.