Skip to main content

MS Partner Tools

SonarCloud

PyPI

Wrapper for the Microsoft Partner Center REST API.

Supports Python 3.8+.

Currently, only a few Partner Center interactions are supported:

  • Enrolling devices in Autopilot on your customers tenant
  • Listing customers
  • Listing devices in a batch group

Installation

pip install ms-partner-tools

or clone the repo and run python setup.py install.

App Registration

In the Azure AD portal, create a new App registration.

Under API permissions, add the Microsoft Partner Center user_impersonation permission. You can search for it under "APIs my organization uses". Please note that this only supports delegated permissions, not application permissions.

The device code flow requires the "Allow public client flows" option to be turned on. This needs a client secret.

If the interactive auth flow is used, you must add the "Mobile and desktop applications" platform and set the "Redirect URI" to http://localhost:8400.

Sample Usage

CLI

You must first run partnertools-cli configure to set up the authentication details (from the app registration).

Registering a device

$ partnertools-cli register-device
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <CODE> to authenticate.
? Please select a customer: Test Customer - (00000000-0000-0000-0000-000000000000)
? Please select a device type: Surface Laptop 4 - Microsoft Corporation
? Please enter the serial number: 000000 

Device was added

SDK

Listing customers

import os
from partner_tools.auth import DeviceCode
from partner_tools import PartnerTools

client = PartnerTools(auth_info=DeviceCode(
    client_id=os.getenv('CLIENT_ID'),
    client_secret=os.getenv('CLIENT_SECRET'),
    tenant_id=os.getenv('TENANT_ID')
))

customers = client.customer.get_customers()

for customer in customers:
    print(f'Customer: {customer["companyProfile"]["companyName"]}, Tenant ID: {customer["id"]}')

Metadata

Release files for ms-partner-tools 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for ms-partner-tools 0.1.1
File Interpreter ABI Platform
ms_partner_tools-0.1.1-py3.8.egg Legacy Egg format - - Details
ms_partner_tools-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / ms_partner_tools-0.1.1-py3.8.egg

Download URL ms_partner_tools-0.1.1-py3.8.egg
Size 31.9 kB
Tags Egg
SHA-256 checksum
How to use checksums
8fd7fcadd8c1c26ed3f41be34e2e903195606e21c34141b520221ad18f0585fc
BLAKE2b-256 checksum
How to use checksums
99127ce8c91e4672bf4026f9ff3dac197153a3d51d88aff6f0444a6448032ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / ms_partner_tools-0.1.1-py3-none-any.whl

Download URL ms_partner_tools-0.1.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56c0162bb78ae1b2ebef4f67f57c6f7656ae200a4d41a1a4187f3a9cfebd11a9
BLAKE2b-256 checksum
How to use checksums
11891a74f28a905767835afcbd5ad16d7bd45045340fdab9a882e690eb9f172d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page