SBN

Spanning Backup for Office 365 PowerShell Module Update 3.4.0.1

Spanning is pleased to bring you a few updates to our popular PowerShell module available on GitHub. This release, 3.4.0.1, adds a Connection parameter that makes automation with Azure Automation Runbooks easier and more secure. We also added a page size parameter to the User request to make it easier to fetch batches of users in fewer requests. While we were at it, we also cleaned up the documentation a bit too.

 

Get-SpanningAuthentication -Connection

If you have been using our PowerShell module in Azure Automation Runbooks you have probably wondered if there is a better way to store the Region, API Token, and Administrator Email parameters. Now there is. In this example we’ll call the Spanning API from a runbook that uses the Connections feature of Azure Automation. Once you have created an Azure Automation Account you can import the Spanning Module and then use a Connection to store and provide the credentials securely.

Import the Module

You must upload the SpanningO365 module to Azure before you can use it in a runbook.

1. On the Automation Account Overview page, choose Modules.
2. Choose Add a module.
3. Upload the zipped SpanningO365.zip module file.
4. Choose OK to import the module.

When your upload and import completes you will see SpanningO365 listed in the modules with a version number of at least 3.4.0.1.

Create a Spanning Connection

Create a Spanning connection with your Administrator email address, API token, and Region.

1. On the Automation Account Overview page, choose Connections.
2. Choose Add a connection.
3. Enter a Name like “Spanning” and a Description like “Connection to Spanning Backup for Office 365 API”.
4. Change the Type to SpanningO365.
5. In the three fields that are revealed enter your AdminEmailRegion, and ApiToken. (If you don’t know what these are please review the introductory video)
6. Click Create to create the connection.

Create a Runbook

Runbooks are the PowerShell scripts of Azure. In this case we’re going to create a simple one to test our connection.

1. On the Automation Account Overview page, choose Runbooks.
2. Choose Create a runbook.
3. Enter a Name like “SpanningTest”.
4. Select a Runbook Type of PowerShell.
5. Click Create to create the runbook.

Now all you need to do is add the code to call the Spanning API.

1. In the Runbook edit pane add the following code. Refer to the picture below to see that this is just 3 lines of code. You can use the Connections section to see the Spanning connection you created earlier. Choose Add to canvas to ensure the Automation Connection is set up correctly.

Clear-SpanningAuthentication
$auth = Get-SpanningAuthentication -Connection $(Get-AutomationConnection -Name ‘Spanning’) -Verbose
Get-SpanningTenantInfo -AuthInfo $auth

2. Click Save.
3. Click Test pane.
4. In the Test pane click Start.
5. After a moment you should see the results from your tenant. In my trial tenant I have 100 licenses and 33 users with 6 assigned.

Get-SpanningUser -Size

The Size parameter has been added to the User centric cmdlets in the module. The default request size for users was 50, we have increased that to 1000. If, for this reason, your script breaks, just add -Size 50 and try your script again. There is no reason that your script should break, because in the previous version we here handling all the requests for you. In this case we have seen that scripts run faster than before. The implementation is simple. Ignore the parameter unless you need it. If you do use it like this:

Get-SpanningUser -Size 100 -UserType Admins

That’s it!

We are excited to bring these new capabilities to our PowerShell module. As we continue to improve our API we’ll add the features to this module. If you have any issues or questions, let us know in the Issues for this repo.

To learn more about the PowerShell Module for Spanning Backup for Office 365, check us out on Github.

Learn More


*** This is a Security Bloggers Network syndicated blog from Spanning authored by Matt McDermott. Read the original post at: https://spanning.com/blog/spanning-backup-for-office-365-powershell-module-update-3401/