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.4.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.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pdynamics-0.2.4.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/51.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pdynamics-0.2.4.tar.gz
Algorithm Hash digest
SHA256 b637e0b528fb470463c4a716a6aa4adc8d2dae4502e0b38947ad60cbb9c4fb83
MD5 24e683f2083597dffaf819691954a312
BLAKE2b-256 1871e84f2d93ee00bb3460578e352f03bb5cbfcbd7b8fa987bad9dec5af95a72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdynamics-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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/51.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pdynamics-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f518c9dd89c1d5c23fcc28172cf2efb1e2347fdcbfa39cf5390f0757ab8ba8c7
MD5 74deeac3eb72094d40cab9a425a71a9b
BLAKE2b-256 4ea5ac0bf4217f68a6bff17eeaed16f28c502a8d329da20e7d18f9a2d61de92e

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