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:
- Go to office 365 admin center -> Azure Active Directory or https://aad.portal.azure.com/yourcompanydomain
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdynamics-0.2.3.tar.gz.
File metadata
- Download URL: pdynamics-0.2.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98f6f29051cae7474a66dbd1815b4eb43598672ac457a5daa418e4daf3053194
|
|
| MD5 |
b14b32d2fce60391a93e12fb406fb892
|
|
| BLAKE2b-256 |
5ca672fcb782028346378eaf112832f312a2793a7376ebed0552e9c6d04bcf68
|
File details
Details for the file pdynamics-0.2.3-py3-none-any.whl.
File metadata
- Download URL: pdynamics-0.2.3-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/49.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c0bcec8302b594be4967ba4b918a4c878debea69aad7b2e820e49e9e6a7bcf7
|
|
| MD5 |
5e60301622d36373467cc3124235dc62
|
|
| BLAKE2b-256 |
de88fc076b72718d2e5d464fb49741ee34d0a6218282801cb399e2e62113253b
|