แก้ไข

แชร์ผ่าน


Validate custom policy files by using TrustFrameworkPolicy schema

You can improve your productivity when editing or writing custom policy files by validating your files before you upload them. You can let Azure Active Directory B2C (Azure AD B2C) to validate the XML policy files when you upload them, but most errors cause the upload to fail. So, we recommend you validate your custom policy files before you upload them. An example of invalid policy file is improperly formatted XML.

It's essential to use a good XML editor such as Visual Studio Code (VS Code). We recommend using VS Code as it allows you to install XML extension, such as XML Language Support by Red Hat. A good XML editor together with extra XML extension allows you to color-codes content, prefills common terms, keeps XML elements indexed, and can validate against an XML schema.

To validate custom policy files, we provide a custom policy XML schema. You can download the schema by using the link https://raw.githubusercontent.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/master/TrustFrameworkPolicy_0.3.0.0.xsd or refer to it from your editor by using the same link. You can also use Azure AD B2C extension for VS Code to quickly navigate through Azure AD B2C policy files, and many other functions. Lean more about Azure AD B2C extension for VS Code.

In this article, you learn how to:

  • Use custom policy XML schema to validate policy files.
  • Use Azure AD B2C extension for VS Code to quickly navigate through your policy files.

Prerequisites

Note

This article is part of the Create and run your own custom policies in Azure Active Directory B2C how-to guide series. We recommend that you start this series from the first article.

Use TrustFrameworkPolicy schema

TrustFrameworkPolicy schema is a custom policy XML schema that allows you to validate policy files:

  1. Install XML extension support by Red Hat in your VS Code editor

  2. Follow the steps in Troubleshoot policy validity to set up fileAssociations your VS Code editor. The instructions also include the procedure to validate your policy file.

Use Azure AD B2C extension

Azure AD B2C extension allows you to understand the organization of your policy files easily. For example, the custom policy explorer allows you to see the custom policy elements you use and to move to them quickly.

  1. Install Azure AD B2C extension in your VS Code editor

  2. Follow the guidance provided in Azure AD B2C extension to learn how to use Azure AD B2C extension.

Note

The community has developed the VS Code extension for Azure AD B2C to help identity developers. The extension is not supported by Microsoft and is made available strictly as-is.

Next steps

Next, learn: