0

It is possible to manage users/groups (AAD) and create automations via Python SDK? My goal is to add email aliases to specific users with Python instead of PS.

Thanks!

Tomer Aharon
  • 57
  • 10
  • Have you seen the Microsoft Graph Python SDK here: https://github.com/microsoftgraph/msgraph-sdk-python-core. – Gaurav Mantri Aug 08 '21 at 12:20
  • Yep. I succeeded to update the mail (SMTP) value with my Python code. But -- I can't found the way to update my proxy addresses (aliases). https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http Any idea? – Tomer Aharon Aug 09 '21 at 13:12

1 Answers1

0

We have few classes in Python where we can manage the credentials and set the emails for them.

Usually emails will be as Username, have a look on parameters we have.

Params

credential = DefaultAzureCredential()
blob_client = BlobClient(storage_url, container_name="blob-container-01",
    blob_name="sample-blob.txt", credential=credential,
    proxies={ "https": "https://username:password@10.10.1.10:1180" }
)

Also below link will help you out with all the functions that can sync with Azure Users and its groups, Setting mail servers, sending mails, adding user to groups etc..

Documentation

Below are the two functions which are helpful for configuring:

def addLocalUser(username, email):
    pwd=getGeneratedPassword()
    subprocess.check_call(['synouser', '--add', username.encode('utf8'), pwd.encode('utf8'), email.encode('utf8'), '0', email.encode('utf8'), '0'])
    addUserToGroup(username, Settings.SynoGroupName)
    logger.debug('Added user.')
    return pwd
        
    
def addLocalUserAndSendMail(email):
    username=email.replace(u'@',Settings.SynoAtSignReplacement)
    pwd=addLocalUser(username, email)
    sendMail(email, Settings.MailSubject, Settings.MailBody.format(username, pwd))
SaiKarri-MT
  • 1,174
  • 1
  • 3
  • 8