|
| 1 | +--- |
| 2 | +title: "Connect MicroMDM with DEP" |
| 3 | +url: dep/connect-to-micromdm |
| 4 | +menu: |
| 5 | + main: |
| 6 | + parent: DEP |
| 7 | + identifier: "Connect MicroMDM with DEP" |
| 8 | + weight: 20 |
| 9 | +--- |
| 10 | + |
| 11 | +To connect MicroMDM with DEP, you'll need to create a new virtual server in the DEP portal, and import the necessary credentials to micromdm: |
| 12 | + |
| 13 | +## Get public key |
| 14 | + |
| 15 | +First, extract the public key which you will need to upload when creating a new virtual server: |
| 16 | + |
| 17 | +``` |
| 18 | +mdmctl get dep-tokens -export-public-key /tmp/DEP_Public_key.pem |
| 19 | +ConsumerKey AccessTokenExpiry |
| 20 | +
|
| 21 | +Wrote DEP public key to: /tmp/DEP_Public_key.pem |
| 22 | +``` |
| 23 | + |
| 24 | +This assumes you've already configured your mdmctl client to talk to the micromdm server. |
| 25 | + |
| 26 | +## Create server in DEP portal and get P7M file |
| 27 | + |
| 28 | +Next, Go to the DEP portal and create a "MDM Server" (as its called in the DEP poral) record. You will be prompted to upload the public key. Once you successfully create the server, you'll be offered a new download - a file ending `.p7m`. This files contains the encrypted DEP tokens. |
| 29 | + |
| 30 | +## Upload P7M file in micromdm |
| 31 | + |
| 32 | +Next, You'll have to import the downloaded `p7m` file somewhere that MicroMDM can access. |
| 33 | + |
| 34 | +``` |
| 35 | +mdmctl apply dep-tokens -import /Users/groob/Downloads/my_dep_token.p7m |
| 36 | +imported DEP token |
| 37 | +``` |
| 38 | + |
| 39 | +If you see a `imported DEP token` message, your MDM server will now be able to sync devices from DEP. You can check to see that the token imported correctly by just listing the DEP tokens: |
| 40 | + |
| 41 | +``` |
| 42 | +mdmctl get dep-tokens |
| 43 | +ConsumerKey AccessTokenExpiry |
| 44 | +CK_4e84a1be9638d4bce37443ff2dad55abcacb… 2018-04-22 07:54:12 +0000 UTC |
| 45 | +``` |
| 46 | + |
| 47 | +## Exporting JSON token. |
| 48 | + |
| 49 | +If you need to interact with DEP directly, there is an option to export the OAUTH token used by the server: |
| 50 | +``` |
| 51 | +mdmctl get dep-tokens -export-token /path/to/stoken.json |
| 52 | +ConsumerKey AccessTokenExpiry |
| 53 | +CK_4e84a1be9638d4bce37443ff2dad55abcacb… 2018-04-22 07:54:12 +0000 UTC |
| 54 | +
|
| 55 | +Wrote DEP token JSON to: /path/to/stoken.json |
| 56 | +``` |
| 57 | + |
| 58 | +## Other resources |
| 59 | + |
| 60 | +The DEP API is documented by Apple [here](https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/MobileDeviceManagementProtocolRef/4-Profile_Management/ProfileManagement.html#//apple_ref/doc/uid/TP40017387-CH7-SW68) and there are several DEP libraries: |
| 61 | + |
| 62 | +- Go: https://github.com/micromdm/dep |
| 63 | +- Python: https://github.com/bruienne/depy |
0 commit comments