0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azureのシステム割り当て済みマネージドIDからAzure API Managementへ認証を通す

Last updated at Posted at 2025-07-09

やりたいこと

Azureリソースのシステム割り当て済みマネージドID(今回はData Factoryを使用)からAzure API ManagementへOAuth認証を通したい。
今回はData Factoryを使っていますが、他リソースでも同様のことができると思います。

Data FactoryでWebアクティビティを作成

予めData Factoryのシステム割り当てマネージドIDを有効化しておき、 認証システム割り当てマネージドID 、リソースを https://management.azure.com/ で指定する。APIMでサブスクリプションキー必須の場合はヘッダーにその情報を入れておく。

image.png

APIMのAPIポリシーを設定

APIのIncomingポリシーを下記の通り設定する。appidacr2 はマネージドIDからであることを示している。もし Unauthorized になる場合は、ログなどを確認して値を微調整する。

    <inbound>
        <base />
        <validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
            <openid-config url="https://sts.windows.net/{テナントID}/.well-known/openid-configuration" />
            <issuers>
                <issuer>https://sts.windows.net/{テナントID}/</issuer>
            </issuers>
            <required-claims>
                <claim name="appidacr" match="any">
                    <value>2</value>
                </claim>
                <claim name="aud">
                    <value>https://management.azure.com/</value>
                </claim>
                <claim name="oid" match="any">
                    <value>{Data Factoryのシステム割り当てマネージドID}</value>
                </claim>
            </required-claims>
        </validate-jwt>
    </inbound>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?