File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed
Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ function New-GraphGetRequest {
4747 $headers [$key ] = $extraHeaders [$key ]
4848 }
4949 }
50+
51+ if (! $headers [' User-Agent' ]) {
52+ $headers [' User-Agent' ] = " CIPP/$ ( $global :CippVersion ?? ' 1.0' ) "
53+ }
54+
5055 # Track consecutive Graph API failures
5156 $TenantsTable = Get-CippTable - tablename Tenants
5257 $Filter = " PartitionKey eq 'Tenants' and (defaultDomainName eq '{0}' or customerId eq '{0}')" -f $tenantid
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ function New-GraphPOSTRequest {
2828 }
2929 }
3030
31+ if (! $headers [' User-Agent' ]) {
32+ $headers [' User-Agent' ] = " CIPP/$ ( $global :CippVersion ?? ' 1.0' ) "
33+ }
34+
3135 if (! $contentType ) {
3236 $contentType = ' application/json; charset=utf-8'
3337 }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ function Invoke-CIPPStandardAddDMARCToMOERA {
5151
5252 $CurrentInfo = $Domains | ForEach-Object {
5353 # Get current DNS records that matches _dmarc hostname and TXT type
54- $RecordsResponse = New-GraphGetRequest - scope ' https://admin.microsoft.com/.default' - TenantID $Tenant - Uri " https://admin.microsoft.com/admin/api/Domains/Records?domainName=$ ( $_.Name ) " - extraHeaders @ { ' User-Agent ' = ' CIPP/1.0 ' }
54+ $RecordsResponse = New-GraphGetRequest - scope ' https://admin.microsoft.com/.default' - TenantID $Tenant - Uri " https://admin.microsoft.com/admin/api/Domains/Records?domainName=$ ( $_.Name ) "
5555 $AllRecords = $RecordsResponse | Select-Object - ExpandProperty DnsRecords
5656 $CurrentRecords = $AllRecords | Where-Object { $_.HostName -eq ' _dmarc' -and $_.Type -eq ' TXT' }
5757 Write-Information " Found $ ( $CurrentRecords.count ) DMARC records for domain $ ( $_.Name ) "
Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ Set-Location -Path $PSScriptRoot
7777$CurrentVersion = (Get-Content .\version_latest.txt).trim()
7878$Table = Get-CippTable - tablename ' Version'
7979Write-Information " Function App: $ ( $env: WEBSITE_SITE_NAME ) | API Version: $CurrentVersion | PS Version: $ ( $PSVersionTable.PSVersion ) "
80+ $global :CippVersion = $CurrentVersion
81+
8082$LastStartup = Get-CIPPAzDataTableEntity @Table - Filter " PartitionKey eq 'Version' and RowKey eq '$ ( $env: WEBSITE_SITE_NAME ) '"
8183if (! $LastStartup -or $CurrentVersion -ne $LastStartup.Version ) {
8284 Write-Information " Version has changed from $ ( $LastStartup.Version ?? ' None' ) to $CurrentVersion "
You can’t perform that action at this time.
0 commit comments