public/api/New-MBSAPIStorageAccount.ps1

function New-MBSAPIStorageAccount {
    <#
    .SYNOPSIS
    Create a Storage account in MBS
     
    .DESCRIPTION
    Calls the POST api/Accounts API to create a new storage account
     
    .PARAMETER DisplayName
    Display name for your storage account
     
    .PARAMETER Type
    Storage Type either as a numeric [0-24] or in a human-readable format such as 'Amazon S3'. Consult with https://api.mspbackups.com/Help/ResourceModel?modelName=AccountType
     
    .PARAMETER AccountSettings
    Accounts settings in a JSON string. You can find the required fields for the JSON here: https://api.mspbackups.com/Help/ResourceModel?modelName=Settings
     
    .PARAMETER ProfileName
    Profile name used with MSP360 PowerShell for MBS API (set via Set-MBSApiCredential)
     
    .EXAMPLE
    New-MBSAPIStorageAccount -DisplayName 'New storage' -Type 'AmazonS3' -AccountSettings '{"AmazonS3":{"AccessKey": "******","SecretKey": "*****","isGovCloud": false}}' -profilename ao
     
    .INPUTS
    System.Management.Automation.PSCustomObject
 
    .OUTPUTS
    String
 
    .NOTES
        Author: Andrey Oshukov
     
    .LINK
     
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true, HelpMessage="Storage Account Display Name", ValueFromPipelineByPropertyName)]
        [string]$DisplayName,
        [Parameter(Mandatory=$true, HelpMessage="Storage Account Type", ValueFromPipelineByPropertyName)]
        [string]$Type,
        [Parameter(Mandatory=$true, HelpMessage="Storage Account Settings", ValueFromPipelineByPropertyName)]
        [string]$AccountSettings,
        [Parameter(Mandatory=$false, HelpMessage="The profile name")]
        [string]$ProfileName
    )
    begin {
        
    }
    process {
        #Storage Type can actually be passed as both [0-24] and in a human-readable format such as 'Amazon S3. Consult with https://api.mspbackups.com/Help/ResourceModel?modelName=AccountType'
        $StorageAccountPost = [ordered]@{
            DisplayName = $DisplayName
            Type = $Type
            AccountSettings = $AccountSettings | ConvertFrom-Json
        }
        $StorageAccountPost | ConvertTo-Json
        $StorageDestinationID = Invoke-RestMethod -Uri ((Get-MBSApiUrl).Accounts) -Method Post -Headers (Get-MBSAPIHeader -ProfileName $ProfileName) -Body ($StorageAccountPost | ConvertTo-Json) -ContentType 'application/json'
        return $StorageDestinationID
    }
    end {
    }
}