Help getting python runbook (azure automation) to access microsoft graph (sharepoint files)

Grant Fullston 25 Reputation points
2024-05-07T07:03:07.2066667+00:00

Hi all,

I would love some help trying to get my python runbook to access my microsoft graph. I have followed this tutorial (https://learn.microsoft.com/en-us/entra/id-governance/identity-governance-automation) and have tested my certificates with a powershell runbook and got the success message.

I am now trying to configure a python implementation, however am getting stuck on what modules i need, how to install them and how I use the credentials of the certificate in a python script to access sharepoint files.

Any help would be much appreciated and some sample code would be lovely. (I am also having issues with python package dependency installation through import_py3package_from_pypi.py as it says i dont have permissions (ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\userenv\scripts\pip.exe' Consider using the --user option or check the permissions.) however I have the Contributor role assigned to the Azure Automation account.

It was suggested earlier to add virtual machine contributor role but i dont have this available as an option in my azure automation access control panel.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,254 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,257 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,821 Reputation points Microsoft Employee
    2024-07-03T08:51:35.1333333+00:00

    To authenticate and access files with Python, you can use the below packages.

    See suggested here for accessing SharePoint files with Graph SDK Python
    https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/docs/drives_samples.md

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.