Functions/Get-AppService.ps1
function Get-AppService{ try{ $scannedAppServiceCerts = New-Object System.Collections.ArrayList; $appServiceCertificates = Get-AzureRmWebAppCertificate -ResourceGroupName $resourceGroupName; foreach($appServiceCertificate in $appServiceCertificates){ $hostNames = $appServiceCertificate.HostNames -Join ','; $scannedAppServiceCert = New-Object PSObject; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "SubscriptionName" -Value $subscriptionName; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "ResourceGroupName" -Value $resourceGroupName; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "Thumbprint" -Value $appServiceCertificate.Thumbprint; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "HostNames" -Value $hostNames; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "SubjectName" -Value $appServiceCertificate.SubjectName; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "IssuedDate" -Value $appServiceCertificate.IssueDate; $scannedAppServiceCert | add-member -MemberType NoteProperty -Name "ExpirationDate" -Value $appServiceCertificate.ExpirationDate; $scannedAppServiceCerts.Add($scannedAppServiceCert) | Out-Null; if($scannedAppServiceCerts){ Set-Output -outputData $scannedAppServiceCerts -outputFileName "AppServiceCerts"; } } } catch { Out-Error $Error[0]; } } |