Skip to content

Instantly share code, notes, and snippets.

@StigHaraldGustavsen
Last active March 29, 2023 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StigHaraldGustavsen/ebaeb85fc04201ba97210ff4b1ea3c9d to your computer and use it in GitHub Desktop.
Save StigHaraldGustavsen/ebaeb85fc04201ba97210ff4b1ea3c9d to your computer and use it in GitHub Desktop.
Access Open Industrial Data Project through AAD.
# first !pip install cognite-sdk
from cognite.client import CogniteClient, ClientConfig
from cognite.client.credentials import OAuthInteractive
# This value will depend on the cluster your CDF project runs on
base_url = 'https://api.cognitedata.com'
tenant_id = '48d5043c-cf70-4c49-881c-c638f5796997'
creds = OAuthInteractive(
authority_url=f"https://login.microsoftonline.com/{tenant_id}",
client_id="1b90ede3-271e-401b-81a0-a4d52bea3273",
scopes=[f"{base_url}/.default"]
)
cnf = ClientConfig(
client_name='publicdata_user',
project='publicdata',
credentials=creds,
base_url=base_url
)
client = CogniteClient(cnf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment