Use Azure Resource Manager SDK-based scripts to manage StorSimple devices

This article describes how Azure Resource Manager SDK-based scripts can be used to manage your StorSimple 8000 series device. A sample script is also included to walk you through the steps of configuring your environment to run these scripts.

This article applies to StorSimple 8000 series devices running in Azure portal only.

Sample scripts

The following sample scripts are available to automate various StorSimple jobs.

Table of Azure Resource Manager SDK-based sample scripts

Azure Resource Manager Script Description
Authorize-ServiceEncryptionRollover.ps1 This script allows you to authorize your StorSimple device to change the service data encryption key.
Create-StorSimpleCloudAppliance.ps1 This script creates an 8010 or an 8020 StorSimple Cloud Appliance. The cloud appliance can then be configured and registered with your StorSimple Data Manager service.
CreateOrUpdate-Volume.ps1 This script creates or modifies StorSimple volumes.
Get-DeviceBackup.ps1 This script lists all the backups for a device registered with your StorSimple Device Manager service.
Get-DeviceBackupPolicy.ps1 This script all the backup policies for your StorSimple device.
Get-DeviceJobs.ps1 This script gets all the StorSimple jobs running on your StorSimple Device Manager service.
Get-DeviceUpdateAvailability.ps1 This script scans the Update server and lets you know if updates are available to install on your StorSimple device.
Install-DeviceUpdate.ps1 This script installs the available updates on your StorSimple device.
Manage-CloudSnapshots.ps1 This script starts a manual cloud snapshot and deletes cloud snapshots older than specified retention days.
Monitor-Backups.ps1 This Azure Automation Runbook PowerShell script reports the status of all backup jobs.
Remove-DeviceBackup.ps1 This script deletes a single backup object.
Start-DeviceBackupJob.ps1 This script starts a manual backup on your StorSimple device.
Update-CloudApplianceServiceEncryptionKey.ps1 This script updates the service data encryption key for all the 8010/8020 StorSimple Cloud Appliances registered with your StorSimple Device Manager service.
Verify-BackupScheduleAndBackup.ps1 This script highlights the missing backups after analyzing all the schedules associated with backup policies. It also verifies the backup catalog with the list of available backups.

Configure and run a sample script

This section takes an example script and details the various steps required to run the script.

Prerequisites

Before you begin, ensure that you have:

For more information about using Azure PowerShell, go to Get started with using Azure PowerShell.

Run Azure PowerShell script

The script used in this example lists all the jobs on a StorSimple device. This includes the jobs that succeeded, failed, or are in progress. Perform the following steps to download and run the script.

  1. Launch Azure PowerShell. Create a new folder and change directory to the new folder.

        mkdir C:\scripts\StorSimpleSDKTools
        cd C:\scripts\StorSimpleSDKTools
    
  2. Download NuGet CLI under the folder created in the previous step. There are various versions of nuget.exe. Choose the version corresponding to your SDK. Each download link points directly to an .exe file. Be sure to right-click and save the file to your computer rather than running it from the browser.

    You can also run the following command to download and store the script in the same folder that you created earlier.

        wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -Out C:\scripts\StorSimpleSDKTools\nuget.exe
    
  3. Download the dependent SDK.

        C:\scripts\StorSimpleSDKTools\nuget.exe install Microsoft.Azure.Management.Storsimple8000series
        C:\scripts\StorSimpleSDKTools\nuget.exe install Microsoft.IdentityModel.Clients.ActiveDirectory -Version 2.28.3
        C:\scripts\StorSimpleSDKTools\nuget.exe install Microsoft.Rest.ClientRuntime.Azure.Authentication -Version 2.2.9-preview
    
  4. Download the script from the sample GitHub project.

        wget https://raw.githubusercontent.com/anoobbacker/storsimpledevicemgmttools/master/Get-DeviceJobs.ps1 -Out Get-DeviceJobs.ps1
    
    
  5. Run the script. When prompted to authenticate, provide your Azure credentials. This script should output a filtered list of all the jobs on your StorSimple device.

        .\Get-StorSimpleJob.ps1 -SubscriptionId [subid] -TenantId [tenant id] -DeviceName [name of device] -ResourceGroupName [name of resource group] -ManagerName[name of device manager] -FilterByStatus [Filter for job status] -FilterByJobType [Filter for job type] -FilterByStartTime [Filter for start date time] -FilterByEndTime [Filter for end date time]
    
    

Sample output

The following output is presented when the sample script is run. The output contains all the jobs that ran on a registered device that started on September 25, 2017 and completed by October 2, 2017.

-----------------------------------------
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Scripts\StorSimpleSDKTools> wget https://raw.githubusercontent.com/anoobbacker/storsimpledevicemgmttools/master/Get-DeviceJobs.ps1 -Out Get-DeviceJobs.ps1
PS C:\Scripts\StorSimpleSDKTools> .\Get-DeviceJobs.ps1 -SubscriptionId 1234ab5c-678d-910e-9fc4-0accc9c0166e -TenantId 12a345bc-67d8-91ef-01ab-2c7cd123ef45 -DeviceName 8600-ABC1234567D89EF -ResourceGroupName Contoso -ManagerName ContosoDeviceMgr -FilterByStartTime "09/25/2017 08:10:02" -FilterByEndTime "10/02/2017 08:10:02"


Status            : Succeeded
StartTime         : 10/2/2017 10:30:02 PM
EndTime           : 10/2/2017 10:31:36 PM
PercentComplete   : 100
Error             :
JobType           : ScheduledBackup
DataStats         : Microsoft.Azure.Management.StorSimple8000Series.Models.DataStatistics
EntityLabel       : ss-asr-policy1
EntityType        : Microsoft.StorSimple/managers/devices/backupPolicies
JobStages         :
DeviceId          : /subscriptions/1234ab5c-678d-910e-9fc4-0accc9c0166e/resourceGroups/Contoso/providers/Microsoft.Stor
                    Simple/managers/ContosoDeviceMgr/devices/8600-SHG0997877L71FC
IsCancellable     : True
BackupType        : CloudSnapshot
SourceDeviceId    :
BackupPointInTime : 1/1/0001 12:00:00 AM
Id                : /subscriptions/1234ab5c-678d-910e-9fc4-0accc9c0166e/resourceGroups/Contoso/providers/Microsoft.Stor
                    Simple/managers/ContosoDeviceMgr/devices/8600-SHG0997877L71FC/jobs/75905c48-b153-4af1-8b21-4b9a2ff9
                    825b
Name              : 75905c48-b153-4af1-8b21-4b9a2ff9825b
Type              : Microsoft.StorSimple/managers/devices/jobs
Kind              : Series8000
-------------------------------------------
CUT              CUT  
-------------------------------------------
Status            : Succeeded
StartTime         : 9/26/2017 5:00:02 PM
EndTime           : 9/26/2017 5:01:20 PM
PercentComplete   : 100
Error             :
JobType           : ScheduledBackup
DataStats         : Microsoft.Azure.Management.StorSimple8000Series.Models.DataStatistics
EntityLabel       : 8010 policy
EntityType        : Microsoft.StorSimple/managers/devices/backupPolicies
JobStages         :
DeviceId          : /subscriptions/1234ab5c-678d-910e-9fc4-0accc9c0166e/resourceGroups/Contoso/providers/Microsoft.Stor
                    Simple/managers/ContosoDeviceMgr/devices/8600-ABC1234567D89EF
IsCancellable     : True
BackupType        : CloudSnapshot
SourceDeviceId    :
BackupPointInTime : 1/1/0001 12:00:00 AM
Id                : /subscriptions/1234ab5c-678d-910e-9fc4-0accc9c0166e/resourceGroups/Contoso/providers/Microsoft.Stor
                    Simple/managers/ContosoDeviceMgr/devices/8600-ABC1234567D89EF/jobs/3cfd8108-db60-4e9a-a8da-6d8fe457
                    8d2b
Name              : 3cfd8108-db60-4e9a-a8da-6d8fe4578d2b
Type              : Microsoft.StorSimple/managers/devices/jobs
Kind              : Series8000



PS C:\Scripts\StorSimpleSDKTools>
--------------------------------------------

Next steps

Use StorSimple Device Manager service to manage your StorSimple device.