MicroStrategy / mstrio-py

Python integration for MicroStrategy
Apache License 2.0
89 stars 59 forks source link

Connecting #141

Closed ChristiaanEmpowerBI closed 1 year ago

ChristiaanEmpowerBI commented 1 year ago

How does one connect to a MicroStrategy Intelligence Server, all within an organization please?

We make use of Singe Sing-On, Active Directory and Standard Authentication.

I have read the connect.py code_snippet, but am not successful. Mainly because I do not understand the security.

LDAP, SSL, Identity Tokens, Signed Certificates... foreign concepts to me.

These security terms are a little above my pay grade, and I never seem to get past them in order to write some code and make use of the features of Python SDK.

Where can I upskill on these topics regarding MicroStrategy instead of just asking ChatGBT and it giving me generic answers please?

ChristiaanEmpowerBI commented 1 year ago

I was able to make a Standard Authentication connection using this code:

`from mstrio.connection Connection

base_url = "http://MyServerIPAddress/MicroStrategyLibrary/api" mstr_username = "MyUsername" mstr_password = "MyPassword" project_id = "MYPROJECTID" conn = Connection(base_url, mstr_username, mstr_password, project_id=project_id)`

https://www2.microstrategy.com/producthelp/Current/mstrio-py/index.html

apiotrowskiMicroStrategy commented 1 year ago

Hi @ChristiaanEmpowerBI To answer your initial question

How does one connect to a MicroStrategy Intelligence Server, all within an organization please? LDAP, SSL, Identity Tokens, Signed Certificates... foreign concepts to me.

The snippet you are using is a correct one to basically connect via direct credentials, concepts used universally throughout the industry, so one down 😄

As an intro, all concepts listed are a generic IT concepts not related specifically to MSTR only. So I assume you may learn about them anywhere you would learn about IT topics: courses, wikipedia, books, etc.

What you need to know for MSTR and mstrio-py specifically is that Connection object in mstrio-py supports those concepts: you can connect via credentials (as above), via Security Token (also available in code snippets), with or without SSL verification (toggle-able via ssl_verify=<bool> flag in Connection object initialization, as in code snippets)

If you are a MicroStrategy Workstation user, the Python editor we offer there would be helpful as connecting would basically limit itself to using conn = get_connection(workstation_data=workstationData) snippet and additional script sections could be just drag'n'dropped onto the editor.

Otherwise, creating a script in Python is basically programming, so some basic knowledge of it would benefit long-term.

Hope this at least pointed you in the right direction 😅

ChristiaanEmpowerBI commented 1 year ago

In my attempt to use the REST API in order to get hold of the identity token, I was able to lock out the account.

My suggestion to anyone trying this is to proceed with caution.