Skip to content

Latest commit

 

History

History
63 lines (33 loc) · 3.45 KB

policy-upload.md

File metadata and controls

63 lines (33 loc) · 3.45 KB

Upload a custom polices directly from Azure AD B2C vscode extension

Register MS Graph delegated permissions application

To upload a policy you need to register a delegated permissions application. Learn how to register a MS Graph application. In the Grant API access section select the Delegate permissions, and then select Read and write your organization's trust framework policies and select Save. Select Grant permissions, and then select Yes. It might take a few minutes to for the permissions to fully propagate.

Add MS Graph

Change the application authentication setting Allow public client flows to Yes. You can find this under "Authentication" -> "Advanced settings" in the menu. Add MS Graph

After it's created, copy the Application ID:

Copy the application ID

Configure your VS code extension

Within VSCode, click on the Settings icon.

Settings

Choose Extensions and then “Azure AD B2C” In the Graph: ClientId, set the value of the application ID you created earlier. IMPORTANT: you can change this setting at the User or Workspace level. Changing it at Workspace lavel is highly recommended since you will be able to use different application IDs for different projects/folders.

vscode-settings-msgraph.png

Upload a single policy

To upload the current policy you are working on:

  • CTRL + SHIFT + U

  • Type B2C Upload Policy

  • You will then see the following. Click Login to launch the browser for Device code login

    Sign-in

  • Enter the code or paste from clipboard (the code should have already been added to the clipboard)

    Sign-in

  • Sign-in with your Azure AD B2C tenant admin account

Policy preview

When you upload a single policy you can run the policy with a URL you reconfigure in the aadb2c.previewUrl settings key.

Replace the 'yourtenant' with your tenant name

When you upload a single policy you can configure the Azure AD B2C extension to replace the 'yourtenant' tenant name that comes with the B2C samples with your tenant name. To change the settings, configure the aadb2c.graph.replaceSamplesYourTenantWit settings key.

Upload all policies for an environment

The default environment name in the extension's settings needs to be configured before using 'Upload all policies' command. if this is not set then the extension will upload policies from the root working folder. Before uploading a specific environment run B2C Policy Build command.

The same process for logging in to Azure should be followed (refer to the "Upload a policy" section above).

To initiate the upload press ALT+SHIFT+U or launch the B2C Upload all policies command in the commands list (CTRL+SHIFT+P).

Once all policies are successfully uploaded a popup will display a success message stating the number of policies uploaded. An error message will be displayed for all failed uploads. If any of the policies have failed to upload the whole job will terminate immediately and an error message will be displayed.