function Set-BlobEffectoryDomainResources {
    <#
    .SYNOPSIS
    Stores the effectory domain resources list as csv in Azure storage.
    .DESCRIPTION
    Stores the effectory domain resources list as csv in Azure storage, while making a backup of the previous state.
    .PARAMETER effectoryResources
    Resources to be exported to CSV.
    .PARAMETER connectionString
    Connection string of the storage account to save to.
    #>

    param(
         [Parameter(Mandatory)]
         [EffectoryDomainNameCheck[]] $effectoryResources,
         [Parameter(Mandatory)]
         [string] $connectionString
    )

    [string] $fileName = "$((Get-Date).ToString("yyyy-MM-dd HH-mm-ss")) - resources.csv"
    Write-Verbose "Storing resources to $($fileName)"

    $context = New-AzStorageContext -ConnectionString $connectionString

    # move to history
    $blobs = Get-AzStorageBlob -Container "dangling-dns" -Context $context 
    if ($null -ne $blobs) {
        foreach ($blob in $blobs) {
            Start-AzStorageBlobCopy -CloudBlob $blob.ICloudBlob -DestContainer "dangling-dns-history" -DestBlob $blob.Name -Context $context -Force >$null
            Remove-AzStorageBlob -Container "dangling-dns" -Blob $blob.Name -Context $context -Force >$null
        }
    }
    
    # store as current
    $effectoryResources | Export-Csv "$Env:temp/$($fileName)" 
    Set-AzStorageBlobContent -Context $context -Container "dangling-dns" -File "$Env:temp/$($fileName)" -Blob $fileName -Force >$null
    Remove-Item -Path "$Env:temp/$($fileName)" 
}