自定义策略和应用洞察

Custom Policies and application insights

我正在尝试让 App Insights 正常工作,以便我可以调试我的政策,使用这个:

https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-troubleshoot-custom

并且基于这个项目: https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/tree/master/LocalAccounts

进行了适当的修改:

<TrustFrameworkPolicy
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
    PolicySchemaVersion="0.3.0.0"
    TenantId="B2CPruebaProteccion.onmicrosoft.com"
    PolicyId="B2C_1A_PasswordReset"
    PublicPolicyUri="http://B2CPruebaProteccion.onmicrosoft.com/B2C_1A_PasswordReset
    UserJourneyRecorderEndpoint="urn:journeyrecorder:applicationinsights">

    <BasePolicy>
        <TenantId>B2CPruebaProteccion.onmicrosoft.com</TenantId>
        <PolicyId>B2C_1A_TrustFrameworkExtensions</PolicyId>
    </BasePolicy>

    <RelyingParty>
        <DefaultUserJourney ReferenceId="PasswordReset" />
        <UserJourneyBehaviors>
            <JourneyInsights TelemetryEngine="ApplicationInsights" InstrumentationKey="00000000-0000-0000-0000-000000000000" DeveloperMode="true" ClientEnabled="false" ServerEnabled="true" TelemetryVersion="1.0.0" />
        </UserJourneyBehaviors>
        <TechnicalProfile Id="PolicyProfile">
        ...
</TrustFrameworkPolicy>

我的数据没有显示在 App Insights 中。我怎么能validate/repair这个错误?

除非您愿意将用户数据推送到应用洞察,否则不要将应用洞察与自定义策略一起使用

旅程记录器端点 - urn:journeyrecorder:applicationinsights 抓取所有内容并将其放入 App Insights,所有用户名、密码都以明文形式存在于 App Insights 中。

最好的办法是创建一个函数应用程序,它接受任何表单主体并将您想要从 B2C 发送的任何声明传递给它,然后使用技术提供商 RESTFul 提供商调用它

这样您就可以阻止敏感数据进入 App insights

他们也很清楚不要在生产环境中使用旅程记录器,因为它会减慢生产速度

您还必须将 DeploymentMode="Development" 属性添加到 TrustFrameworkPolicy 元素。

例如:

<TrustFrameworkPolicy
  PolicySchemaVersion="0.3.0.0"
  TenantId="contoso.onmicrosoft.com"
  PolicyId="B2C_1A_sign_up_sign_in"
  PublicPolicyUri="http://contoso.onmicrosoft.com"
  DeploymentMode="Development"
  UserJourneyRecorderEndpoint="urn:journeyrecorder:applicationinsights"
  xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
</TrustFrameworkPolicy>