function CheckIpAddresses() {
    param(
    [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext]$subscription,
     [Parameter(Mandatory)]
     [Microsoft.Azure.Commands.Network.Models.PSPublicIpAddress[]] $ipAddresses,
     [Parameter(Mandatory)]
     [string]$effectoryDomainPattern
    )
    [EffectoryDomainNameCheck[]]$Result = @()
    
    # public ip => Assume binding if an IP has a domain name. 

    foreach($ipAddress in $ipAddresses) {
        $resource = Get-AzResource -ResourceId $ipAddress.Id
        $domainNameCheck = [EffectoryDomainNameCheck] @{
            SubscriptionId = $subscriptionId; 
            SubscriptionName = $subscription.Name;
            ResourceId = $ipAddress.Id;
            ResourceName = $ipAddress.Name;
            ResourceType = $resource.ResourceType;
            ResourceGroupName = $resource.ResourceGroupName;
            DomainName = $ipAddress.DnsSettings.DomainNameLabel;
            Tag_Team = $resource.Tags.team
            Tag_Product = $resource.Tags.product
            Tag_Environment = $resource.Tags.environment
            Tag_Data = $resource.Tags.data
        }
        $Result += $domainNameCheck
    }

    $Result
}