function CheckStorageAccounts() {
    param(
    [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext]$subscription,
     [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount[]] $storageAccounts,
     [Parameter(Mandatory)]
     [string]$effectoryDomainPattern
    )
    [EffectoryDomainNameCheck[]]$Result = @()
    
    foreach($storageAccount in $storageAccounts) {
        $resource = Get-AzResource -ResourceId $storageAccount.Id

        $domainNameCheck = [EffectoryDomainNameCheck] @{
            SubscriptionId = $subscriptionId; 
            SubscriptionName = $subscription.Name;
            ResourceId = $storageAccount.Id;
            ResourceName = $resource.Name;
            ResourceType = $resource.ResourceType;
            ResourceGroupName = $resource.ResourceGroupName;
            DomainName = $storageAccount.CustomDomain.Name;
            Tag_Team = $resource.Tags.team
            Tag_Product = $resource.Tags.product
            Tag_Environment = $resource.Tags.environment
            Tag_Data = $resource.Tags.data
        }
        $Result += $domainNameCheck
    }

    $Result
}