我正在尝试创建intune应用程序保护策略。我试过下面的API来做,但没有一个工作: POST / managedAppPolicies / - 创建托管策略(适用于iOS和Android) - 返回401 Unauthorized。
示例创建托管应用程序策略请求:
POST /managedAppPolicies/
Request Body :
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#managedAppPolicies/$entity",
"@odata.type": "#microsoft.graph.iosManagedAppProtection",
"displayName": "Test IOS Policy",
"description": "test",
"periodOfflineBeforeAccessCheck": "PT12H",
"periodOnlineBeforeAccessCheck": "PT30M",
"allowedInboundDataTransferSources": "allApps",
"allowedOutboundDataTransferDestinations": "allApps",
"organizationalCredentialsRequired": false,
"allowedOutboundClipboardSharingLevel": "allApps",
"dataBackupBlocked": true,
"deviceComplianceRequired": true,
"managedBrowserToOpenLinksRequired": false,
"saveAsBlocked": false,
"periodOfflineBeforeWipeIsEnforced": "P90D",
"pinRequired": true,
"maximumPinRetries": 5,
"simplePinBlocked": false,
"minimumPinLength": 4,
"pinCharacterSet": "any",
"allowedDataStorageLocations": [
"oneDriveForBusiness",
"sharePoint"
],
"contactSyncBlocked": false,
"printBlocked": false,
"fingerprintBlocked": false,
"targetedSecurityGroupIds": [ "valid directory group id 1",
"valid directory group id 2" ],
"appDataEncryptionType": "whenDeviceLocked"
}
回复:401未经授权
{
"error": {
"code": "UnknownError",
"message": "{\"ErrorCode\":\"Forbidden\",\"Message\":\"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: f932cecd-028f-42ea-9464-abf6e04f9ede - Url: https://fef.amsua0502.manage.microsoft.com/MAMAdmin/MAMAdminFEService/managedAppPolicies?api-version=2016-06-16 - CustomApiErrorPhrase: \",\"Target\":null,\"Details\":null,\"InnerError\":null,\"InstanceAnnotations\":[]}",
"innerError": {
"request-id": "f932cecd-028f-42ea-9464-abf6e04f9ede",
"date": "2017-03-03T17:44:10"
}
} }
我在azure门户网站上创建了一个WebApp,并且还为我的应用程序提供了DeviceManagementApps.ReadWrite.All权限。 access_token是使用
以编程方式获得的https://login.microsoftonline.com/<tenantid>/oauth2/token
可以在应用程序的上下文中获取它,而不是在Web表单上提供用户凭据(用户授权方法)
P.S。我确保从clientid和secret生成的access_token是正确的,因为当用于搜索azure上的组时,同一令牌可以正常工作。
GET https://graph.microsoft.com/beta/groups?$filter=startswith(displayName,%27test users%27)
答案 0 :(得分:1)
用户没有获得intune许可证。您可以尝试向您的RBAC用户授予许可吗?
答案 1 :(得分:0)
我在Microsoft Intune团队工作,特别是Microsoft Intune和Microsoft Graph之间的集成。
我能够在我们的日志记录中找到错误消息,并且基于您的帖子,您似乎正在尝试使用仅应用程序令牌(无用户凭据),当前通过Microsoft Graph公开的Microsoft Intune API仅支持app +用户令牌(需要用户凭据)。
希望这有帮助
彼得