あとで困らないための azure active directory 連携開発 a to z...•azure...
TRANSCRIPT
![Page 1: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/1.jpg)
あとで困らないための
Azure Active Directory 連携開発 A to Z
AD42
![Page 2: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/2.jpg)
その知識、どこで使える ?
![Page 3: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/3.jpg)
• Azure との連携開発 (All Service)• Azure における RBAC 設定 (Service すべて)
• App Service AuthN / AuthZ
• Data Lake Store Access Permissions, SQL Database Credentials, etc…
• Office 365 との連携開発 (All App)• API 連携 (App すべて)
• In App での Auth (Office Add-in, Teams Tab, etc)
• Dynamics CRM / ERP との連携開発• Bot Service を使った開発• Power BI との連携開発 etc…
その知識、どこで使える ?
- Linux App Service / VM (Preview)
az vm extension set ¥--publisher Microsoft.Azure.ActiveDirectory.LinuxSSH ¥--name AADLoginForLinux ¥--resource-group myResourceGroup ¥--vm-name myVM
![Page 4: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/4.jpg)
https://login.microsoftonline.com/ /oauth2
![Page 5: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/5.jpg)
認証・認可のフロー (OAuth の場合)Protected
API
![Page 6: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/6.jpg)
Consistency
Web
Mobile
![Page 7: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/7.jpg)
役割の明確化
開発者にとってのブラックボックス
など . . . .
開発者の関心 IT 管理者の関心
![Page 8: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/8.jpg)
クライアントとアクセスパターン
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 9: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/9.jpg)
クライアントとアクセスパターン
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 10: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/10.jpg)
POST https://login.microsoftonline.com/common/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=<received refresh token>&client_id=<client id>&resource=<another resource id>
{
"access_token":"eyJ0eXAiOiJKV1. . .",
"token_type":"Bearer",
"expires_in":"28800",
"expires_on":"1373631999",
. . .
}
![Page 11: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/11.jpg)
クライアントとアクセスパターン
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 12: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/12.jpg)
POST https://login.microsoftonline.com/common/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&
assertion=<received access token>&requested_token_use=on_behalf_of&
resource=<new resource>&scope=openid&client_id=<new client id>&client_secret=<new client secret>
{
"access_token":"eyJ0eXAiOiJKV1. . .",
"token_type":"Bearer",
"expires_in":"28800",
"expires_on":"1373631999",
. . .
}
![Page 13: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/13.jpg)
クライアントとアクセスパターン
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 14: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/14.jpg)
https://login.microsoftonline.com/common/oauth2/authorize?response_type=token&client_id=2ecc2d71-8fcc-4007-b18e-165413028cae&resource=https%3A%2F%2Ftest-sv.azurewebsites.net&redirect_uri=https%3A%2F%2Ftest.com%2Ftest.html
https://test.com/test.html#access_token=eyJ0eXAiOi...&token_type=Bearer&expires_in=3599&session_state=eb83c98a-9831-4b18-b1a1-bdf483104d66
HTML Azure AD
#access_token=eyJ0eXAiOi...
![Page 15: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/15.jpg)
クライアントとアクセスパターン
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 16: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/16.jpg)
App Azure AD
POST https://login.microsoftonline.com/xxx.onmicrosoft.com/oauth2/token
Content-Type: application/x-www-form-urlencoded
resource=. . . &client_id=. . . &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=eyJhbGciOiJSUzI...&grant_type=client_credentials
![Page 17: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/17.jpg)
2 つのエンドポイント : v1 and v2
v2.0
![Page 18: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/18.jpg)
v2 endpoint の対応シナリオとクライアントタイプ
Client Type Access Pattern
Web Clientclient id と client secret の使用
(client secret で「なりすまし」を防止)
Native Clientrefresh token を使用した「なりすまし」防止
(client secret は不使用)
Single Page Web Clientrefresh token も client secret も使わない方式
(token 取り直しには hidden iframe を使用)
Daemon / Service ClientLogin UI を伴わない App-only context
(client secret を使用)
Scenario Access Pattern
オフライン接続 refresh token を使用した access token の取り直し
(別 resource も指定可能)複数リソースの使用
Impersonation (偽装)access token を使用した access token の取り直し
(on_behalf_of パラメーターを使用)
![Page 19: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/19.jpg)
OAuth における Azure AD 独自の仕様
![Page 20: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/20.jpg)
OAuth における Azure AD 独自の仕様Office 365
API
"access_token":"eyJ0eXAiOiJKV1. . ."
token1 token2 token3. .
dot (.) 区切りのトークンRFC 4648 による変形 Base 64 エンコード文字列
{
"typ":"JWT",
"alg":"RS256",
"x5t":"MnC_VZcA..."
}
{
"aud":"https://testcorp.onmicrosoft.com/",
"given_name":"Taro",
"family_name":"Demo",
"appid":"e29d918e-4da6-4d42-aeb2-d949b73be432",
...
}
デジタル署名
"access_token":"eyJ0eXAiOiJKV1. . ."
![Page 21: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/21.jpg)
OAuth における Azure AD 独自の仕様
resource=someservice
![Page 22: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/22.jpg)
Administrator Consent
![Page 23: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/23.jpg)
prompt=admin_consent
{tenant realm}/adminconsent
Administrator Consent
![Page 24: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/24.jpg)
v2 endpoint における Administrator Consent
![Page 25: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/25.jpg)
v2 endpoint における Administrator Consent
![Page 26: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/26.jpg)
Azure における Permission の考え方
![Page 27: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/27.jpg)
Azure における Permission の考え方
![Page 28: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/28.jpg)
Azure AD Managed Service Identity (MSI)
App Service
Azure Service
(e.g., ARM, Key Vault)Your code
Local token
service
Credentials
1
2
3
Azure (inject and roll credentials)
![Page 29: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/29.jpg)
![Page 30: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/30.jpg)
![Page 31: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/31.jpg)
API による管理 (Microsoft Graph)
![Page 32: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/32.jpg)
API によるWorkflow Automation 例
新規の採用
• Set profile
• Assign licenses
• Set manager
デバイスの付与
• Provision mobile device
• Register owner
アクセス認可
• Assign to groups
• Assign to roles
POST /users
POST /users/{id}/manager/$ref
POST /users/{id}/assignLicense
POST /groups/{id}/members/$ref
POST
/groups/{id}/directoryRoles/$ref
POST /devices
POST
/devices/{id}/registere
dOwners
![Page 33: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/33.jpg)
ユーザー同期
Delta Query (id による $filter)
![Page 34: あとで困らないための Azure Active Directory 連携開発 A to Z...•Azure との連携開発(All Service) •Azure におけるRBAC 設定(Service すべて) •App Service](https://reader033.vdocuments.us/reader033/viewer/2022052013/60299b81d1748a3165615d3e/html5/thumbnails/34.jpg)
© 2018 Microsoft Corporation. All rights reserved.
本コンテンツの著作権、および本コンテンツ中に出てくる商標権、団体名、ロゴ、製品、サービスなどはそれぞれ、各権利保有者に帰属します。