function CheckWebApps() {
    param(
    [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext]$subscription,
     [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.WebApps.Models.PSSite[]] $webApps,
     [Parameter(Mandatory)]
     [string]$effectoryDomainPattern
    )
    [EffectoryDomainNameCheck[]]$Result = @()
    
    $webAppsEffectory = $webApps | Where-Object {@($_.HostNames) -like $effectoryDomainPattern} 
    foreach ($webAppEffectory in $webAppsEffectory) {
        foreach ($hostName in $webAppEffectory.HostNames | Where-Object {$_ -like $effectoryDomainPattern}) {
            $domainNameCheck = [EffectoryDomainNameCheck] @{
                SubscriptionId = $subscriptionId; 
                SubscriptionName = $subscription.Name;
                ResourceId = $webAppEffectory.Id;
                ResourceName = $webAppEffectory.Name;
                ResourceType = $webAppEffectory.Type;
                ResourceGroupName = $webAppEffectory.ResourceGroup;
                DomainName = $hostName;
                Tag_Team = $webAppEffectory.Tags.team
                Tag_Product = $webAppEffectory.Tags.product
                Tag_Environment = $webAppEffectory.Tags.environment
                Tag_Data = $webAppEffectory.Tags.data
            }
            $Result += $domainNameCheck
        }
    }

    $Result
}