Functions/Export-BsgToBlobStorage.ps1

<#
    .SYNOPSIS
        Copy the local backup into a Blobl Storage Location
         
    .DESCRIPTION
        Copy the local backup into a Blobl Storage Location
 
    .PARAMETER Path
        String with the path of the locaction of the backup and activity event files
 
    .PARAMETER URLBlob
        String with the URL to the Blob storage location
 
    .EXAMPLE
        # Export the backup files files into Blob Storage.
        Export-BsgToBlobStorage -Path "C:\temp\BSGPBIAdministration" -URLBlob "https://[account].blob.core.windows.net/[container]/[path/to/directory]"
 
         
    .INPUTS
 
    .OUTPUTS
     
    .NOTES
#>


function Export-BsgToBlobStorage {
    param(
        [Parameter(Mandatory=$true)][string]$Path,
        [Parameter(Mandatory=$true)][string]$URLBlob
    )

    ## Path Validation
    ##
    if ((Test-Path -Path $Path -PathType Container) -eq $false){
        throw "The path to save the json files doesn't exists or it isn't a folder."
    }

    try{
        $azcopyversion = azcopy --version
    }catch {
        throw "AzCopy is not installed. Please install it from https://aka.ms/downloadazcopy-v10-windows"
    }

    try {
        Write-Verbose "Trying to delete the current folder in Azure Storage Account"
        AzCopy rm $URLBlob --recursive=true
    }catch {

    }

    Write-Verbose "Uploading the files into the folder in Azure Storage Account"
    AzCopy copy $Path $URLBlob --recursive=true

}