shell-intune-samples | Sample shell scripts for Intune admins | Script Programming library
kandi X-RAY | shell-intune-samples Summary
kandi X-RAY | shell-intune-samples Summary
Sample shell scripts for Intune admins.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of shell-intune-samples
shell-intune-samples Key Features
shell-intune-samples Examples and Code Snippets
Community Discussions
Trending Discussions on shell-intune-samples
QUESTION
We want to enable uploading apps to the Intune store via an API.
I saw this example on GitHub, and want to do something similar in JS, so I've tried using the same REST calls.
The problem is, I can't seem to make the https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
request properly - I always get 401. When making the same request via the Graph API Explorer it works fine.
I tried fixing my permissions, and I'm kinda stuck getting the correct token. I did the following steps with an admin account, on both the "common" and our own tennant:
Called the admin consent -
https://login.microsoftonline.com/nativeflow.onmicrosoft.com/adminconsent?client_id=&redirect_uri=
Got authorization from the user -
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=&response_type=code&redirect_uri=&response_mode=query&scope=DeviceManagementApps.ReadWrite.All
POST request to get the actual token -
https://login.microsoftonline.com/nativeflow.onmicrosoft.com/oauth2/v2.0/token
with the following body:
...
ANSWER
Answered 2018-Jul-25 at 20:17You have a couple issues going on:
You're using the Authorization Code Grant workflow but requesting Client Credentials.
The scope
Device.ReadWrite.All
is an application scope, it is only applicable to Client Credentials. It isn't a valid Delegated scope so it will return an error when you attempt to authenticate a user (aka delegate) usingDevice.ReadWrite.All
.Your body is using
key:value
but it should be using standard form encoding (key=value
).
To get this working, you need to request a token without a user. This is done by skipping your 2nd step and moving directly to retrieving a token (body line-breaks are only for readability):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install shell-intune-samples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page