Skip to main content

Python connector for Microsoft Dynamics 365, supports AD, IFD and Online

Project description

Python connector for Dynamics 365

How to Install

pip install pdynamics

Usage

from pdynamics import crm

On-Premises

AD

Connect on-premises organizations via user and password

AD access sample:

crmurl = 'http://servername:port/orgname/'
user = 'domain\\username'
password = 'yourpassword'
crmorg = crm.client(crmurl, user, password)
crmorg.test_connection()

IFD

Connect to Dynamics 365 IFD organizations, access_token is required to send requests, it's necessary to create an application group, it has a client id. For example: client id is: 289c7417-83b7-41c3-8fab-68f111b5ba60, and CRM IFD URL is https://mycrmorg.company.com:443/

Run powershell as Admin on AD FS server

PS C:\windows\system32> Grant-AdfsApplicationPermission
cmdlet Grant-AdfsApplicationPermission at command pipeline position 1
Supply values for the following parameters:
ClientRoleIdentifier: 289c7417-83b7-41c3-8fab-68f111b5ba60
ServerRoleIdentifier: https://mycrmorg.company.com:443/

What's the token endpoint?

When log in CRM, system will redirect to ADFS login page, url is something like https://mycrmorg.company.com:5555/adfs/ls/?wa=wsignin1.0&wtrealm=....., then your token endpoint will be https://mycrmorg.company.com:5555/adfs/oauth2/token

IFD Connection Sample:

crmurl = 'https://mycrmorg.company.com:443/'
tokenurl = 'https://mycrmorg.company.com:5555/adfs/oauth2/token'
user = 'domain\\username'
password = 'yourpassword'
clientid = '289c7417-83b7-41c3-8fab-68f111b5ba60'
crmorg = crm.client(crmurl, user, password, clientid, tokenurl)
crmorg.test_connection()

Online

Access Dynamics 365 Online:

  1. Go to office 365 admin center -> Azure Active Directory or https://aad.portal.azure.com/yourcompanydomain
  2. Azure Active Directory -> App registrations -> Register an application a. input a Name b. select "Accounts in this organizational directory only (Single tenant)" - other options might also work c. Manage -> Certificates & secrets -> New client secret (keep this client_secret for later use) d. API permissions -> Add a permission -> Select an API -> Microsoft APIs-> Dynamics CRM e. Grant admin consent for '{your company}' f. Find client id (Application ID) in Overview page

Dynamics 365 Online Connection Sample:

crmurl = 'https://mycrmorg.crm.dynamics.com/'
user = 'username@mycrmorg.onmicrosoft.com'
password = 'yourpassword'
clientid = '289c7417-83b7-41c3-8fab-68f111b5ba60'
clientsecret = 'Pq-oEk~_7044Q2V~QGXwaH~2v9k0qlSG1K'
crmorg = crm.client(crmurl, user, password, clientid, client_secret=clientsecret)
crmorg.test_connection()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdynamics-0.2.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdynamics-0.2.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pdynamics-0.2.2.tar.gz.

File metadata

  • Download URL: pdynamics-0.2.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pdynamics-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1e2127dea4a99f554222794a8a8cb2a7ce99d9ef62e39cb15a7f364addcb8df2
MD5 b35e4bf45c55fdd87a73a522d57e13dd
BLAKE2b-256 7187071e90334e7d871aefaf2abc7ba560177c880aac63ddb5e107d895bd502f

See more details on using hashes here.

File details

Details for the file pdynamics-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pdynamics-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pdynamics-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be8d518997c0f263a51b73371d134c42e49bf4e44512afd4bcc0b3e0e5038553
MD5 1b19359c2a65e2ae496100ba68b273ae
BLAKE2b-256 25c79d39f6d459c735aeb43bdd3b1676fa1ff613c8152c66de84037b354d880f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page