Skip to content

Commit

Permalink
testing path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelvin Tegelaar committed Aug 24, 2022
1 parent b080935 commit f8c99ca
Show file tree
Hide file tree
Showing 29 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion AddChocoApp/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug"

Set-Location $ENV:CippRoot

Write-Host "PowerShell HTTP trigger function processed a request."
$ChocoApp = $request.body
Expand Down
1 change: 0 additions & 1 deletion AddChocoApp_OrchestrationStarterTimer/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
param($Timer)

try {
$CurrentlyRunning = Get-Item 'ChocoApps.Cache\CurrentlyRunning.txt' -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-24)
if ($CurrentlyRunning) {
$Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' }
Write-LogMessage -API 'ChocoApps' -message 'Attempted to start upload but an instance was already running.' -sev Info
Expand Down
2 changes: 1 addition & 1 deletion AddMSPApp/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

Set-Location $ENV:CippRoot

Write-Host 'PowerShell HTTP trigger function processed a request.'
$RMMApp = $request.body
Expand Down
2 changes: 1 addition & 1 deletion Applications_Upload/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
param($name)
$Table = Get-CippTable -tablename 'apps'
$Filter = "PartitionKey eq 'apps' and RowKey eq '$name'"

Set-Location $ENV:CippRoot
$ChocoApp = (Get-AzDataTableRow @Table -filter $Filter).JSON | ConvertFrom-Json
$intuneBody = $ChocoApp.IntuneBody
$tenants = if ($chocoapp.Tenant -eq "AllTenants") {
Expand Down
1 change: 1 addition & 0 deletions BestPracticeAnalyser_All/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ catch {
try {
$LicenseUsage = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscribedSkus' -tenantid $Tenant
# Import the licenses conversion table
Set-Location $ENV:CippRoot
$ConvertTable = Import-Csv Conversiontable.csv | Sort-Object -Property 'guid' -Unique
$Table = Get-CIPPTable -TableName ExcludedLicenses
$ExcludeList = Get-AzDataTableEntity @Table
Expand Down
2 changes: 1 addition & 1 deletion BestPracticeAnalyser_GetQueue/run.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param($name)

Set-Location $ENV:CippRoot
#$Skiplist = (Get-Content ExcludedTenants -ErrorAction SilentlyContinue | ConvertFrom-Csv -Delimiter "|" -Header "name", "date", "user").name
$Tenants = Get-Tenants #Get-Content ".\tenants.cache.json" | ConvertFrom-Json | Where-Object {$Skiplist -notcontains $_.defaultDomainName}

Expand Down
1 change: 0 additions & 1 deletion BestPracticeAnalyser_OrchestrationStarter/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using namespace System.Net

param($Request, $TriggerMetadata)
$CurrentlyRunning = Get-Item "Cache_BestPracticeAnalyser\CurrentlyRunning.txt" -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-24)
if ($CurrentlyRunning) {
$Results = [pscustomobject]@{"Results" = "Already running. Please wait for the current instance to finish" }
Write-LogMessage -API "BestPracticeAnalyser" -message "Attempted to start analysis but an instance was already running." -sev Info
Expand Down
2 changes: 1 addition & 1 deletion DomainAnalyser_List/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using namespace System.Net

# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)

Set-Location $ENV:CippRoot
$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

Expand Down
1 change: 0 additions & 1 deletion DomainAnalyser_OrchestrationStarter/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using namespace System.Net

param($Request, $TriggerMetadata)
$CurrentlyRunning = Get-Item 'Cache_DomainAnalyser\CurrentlyRunning.txt' -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-24)
if ($CurrentlyRunning) {
$Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' }
Write-LogMessage -API 'DomainAnalyser' -message 'Attempted to start domain analysis but an instance was already running.' -sev Info
Expand Down
1 change: 0 additions & 1 deletion Domain_OrchestrationStarterTimer/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if ($env:DEV_SKIP_DOMAIN_TIMER) {
}

try {
$CurrentlyRunning = Get-Item 'Cache_DomainAnalyser\CurrentlyRunning.txt' -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-24)
if ($CurrentlyRunning) {
$Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' }
Write-LogMessage -API 'DomainAnalyser' -message 'Attempted to start analysis but an instance was already running.' -sev Info
Expand Down
1 change: 0 additions & 1 deletion ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
if (!(Get-Module -ListAvailable AzTable)) {
Install-Module AzTable -Confirm:$false -Force
}

$Logo = @'
_____ _____ _____ _____
/ ____|_ _| __ \| __ \
Expand Down
2 changes: 1 addition & 1 deletion ExecMaintenanceScripts/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

Set-Location $ENV:CippRoot
try {
$GraphToken = Get-GraphToken -returnRefresh $true
$AccessTokenDetails = Read-JwtAccessDetails -Token $GraphToken.access_token
Expand Down
2 changes: 1 addition & 1 deletion ExecOffboardUser/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ try {
$Tenantfilter = $request.body.tenantfilter
if ($username -eq $null) { exit }
$userid = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($username)" -tenantid $Tenantfilter).id

Set-Location $ENV:CippRoot
$ConvertTable = Import-Csv Conversiontable.csv | Sort-Object -Property 'guid' -Unique

Write-Host ($request.body | ConvertTo-Json)
Expand Down
2 changes: 1 addition & 1 deletion ExecSAMSetup/run.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using namespace System.Net

Set-Location $ENV:CippRoot
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$UserCreds = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($request.headers.'x-ms-client-principal')) | ConvertFrom-Json)
Expand Down
2 changes: 1 addition & 1 deletion GetVersion/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using namespace System.Net

# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)

Set-Location $ENV:CippRoot
$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug"

Expand Down
1 change: 1 addition & 0 deletions GraphHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ function New-GraphPOSTRequest ($uri, $tenantid, $body, $type, $scope, $AsApp) {
}

function convert-skuname($skuname, $skuID) {
Set-Location $ENV:CippRoot
$ConvertTable = Import-Csv Conversiontable.csv
if ($skuname) { $ReturnedName = ($ConvertTable | Where-Object { $_.String_Id -eq $skuname } | Select-Object -Last 1).'Product_Display_Name' }
if ($skuID) { $ReturnedName = ($ConvertTable | Where-Object { $_.guid -eq $skuid } | Select-Object -Last 1).'Product_Display_Name' }
Expand Down
2 changes: 1 addition & 1 deletion ListCAtemplates/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug"

Set-Location $ENV:CippRoot

# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
Expand Down
2 changes: 1 addition & 1 deletion ListIntuneTemplates/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Accessed this API" -Sev "Debug"

Set-Location $ENV:CippRoot

$Table = Get-CippTable -tablename 'templates'

Expand Down
1 change: 1 addition & 0 deletions ListLicenses/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ else {
$GraphRequest = $Rows
}
}
Set-Location $ENV:CippRoot
$ConvertTable = Import-Csv Conversiontable.csv
if (!$GraphRequest) {
$GraphRequest = foreach ($singlereq in $RawGraphRequest) {
Expand Down
2 changes: 1 addition & 1 deletion ListLicensesAllTenants/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $RawGraphRequest = Get-Tenants | ForEach-Object -Parallel {
}
}
}

Set-Location $ENV:CippRoot
$ConvertTable = Import-Csv Conversiontable.csv
$Table = Get-CIPPTable -TableName cachelicenses

Expand Down
2 changes: 1 addition & 1 deletion ListSharepointSettings/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Write-Host "PowerShell HTTP trigger function processed a request."
$TenantFilter = $Request.Query.TenantFilter
try {
$body = '{"deletedUserPersonalSiteRetentionPeriodInDays":360}'
$GraphRequest = New-GraphPostRequest -tenantid $TenantFilter -Uri "https://graph.microsoft.com/beta/admin/sharepoint/settings" -AsApp $true -Type patch -Body $body -ContentType "application/json"
$GraphRequest = $ENV:CippRoot
$StatusCode = [HttpStatusCode]::OK
}
catch {
Expand Down
2 changes: 1 addition & 1 deletion ListStandards/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using namespace System.Net

# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)

Set-Location $ENV:CippRoot
$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
$Table = Get-CippTable -tablename 'standards'
Expand Down
1 change: 1 addition & 0 deletions ListUsers/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $selectlist = "id", "accountEnabled", "businessPhones", "city", "createdDateTime
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
$ConvertTable = Import-Csv Conversiontable.csv | Sort-Object -Property 'guid' -Unique
Set-Location $ENV:CippRoot
# Interact with query parameters or the body of the request.
$TenantFilter = $Request.Query.TenantFilter
$userid = $Request.Query.UserID
Expand Down
8 changes: 4 additions & 4 deletions Standards_ExcludedfileExt/run.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
param($tenant)
if ((Test-Path ".\Cache_Standards\$($Tenant).Standards.json")) {
$Setting = (Get-Content ".\Cache_Standards\$($Tenant).Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.ExcludedfileExt
$ConfigTable = Get-CippTable -tablename 'standards'
$Setting = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq '$tenant'").JSON | ConvertFrom-Json).standards.ExcludedfileExt
if (!$Setting) {
$Setting = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq 'AllTenants'").JSON | ConvertFrom-Json).standards.ExcludedfileExt
}

if (!$Setting) { $Setting = (Get-Content ".\Cache_Standards\AllTenants.Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.ExcludedfileExt }

try {
$Exts = $Setting.ext -split ','
$body = ConvertTo-Json -InputObject @{ excludedFileExtensionsForSyncApp = @($Exts) }
Expand Down
8 changes: 4 additions & 4 deletions Standards_MailContacts/run.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
param($tenant)
if ((Test-Path ".\Cache_Standards\$($Tenant).Standards.json")) {
$Contacts = (Get-Content ".\Cache_Standards\$($Tenant).Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.MailContacts
$ConfigTable = Get-CippTable -tablename 'standards'
$Contacts = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq '$tenant'").JSON | ConvertFrom-Json).standards.MailContacts
if (!$Contacts) {
$Contacts = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq 'AllTenants'").JSON | ConvertFrom-Json).standards.MailContacts
}

if (!$contacts) { $Contacts = (Get-Content ".\Cache_Standards\AllTenants.Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.MailContacts }

try {
$TenantID = (New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/organization" -tenantid $tenant)
$Body = [pscustomobject]@{}
Expand Down
9 changes: 4 additions & 5 deletions Standards_OauthConsent/run.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
param($tenant)
if ((Test-Path ".\Cache_Standards\$($Tenant).Standards.json")) {
$AllowedAppIdsForTenant = (Get-Content ".\Cache_Standards\$($Tenant).Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).Standards.OauthConsent.AllowedApps -split ','
}
else {
$AllowedAppIdsForTenant = (Get-Content ".\Cache_Standards\AllTenants.Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).Standards.OauthConsent.AllowedApps -split ','
$ConfigTable = Get-CippTable -tablename 'standards'
$AllowedAppIdsForTenant = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq '$tenant'").JSON | ConvertFrom-Json).Standards.OauthConsent.AllowedApps -split ','
if (!$AllowedAppIdsForTenant) {
$AllowedAppIdsForTenant = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq 'AllTenants'").JSON | ConvertFrom-Json).Standards.OauthConsent.AllowedApps -split ','
}
try {
$State = (New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy" -tenantid $tenant)
Expand Down
1 change: 0 additions & 1 deletion Standards_OrchestrationStarter/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using namespace System.Net

param($Request, $TriggerMetadata)
$CurrentlyRunning = Get-Item "Cache_Standards\CurrentlyRunning.txt" -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-4)
if ($CurrentlyRunning) {
$Results = [pscustomobject]@{"Results" = "Already running. Please wait for the current instance to finish" }
Write-LogMessage -API "StandardsApply" -message "Attempted to Standards but an instance was already running." -sev Info
Expand Down
9 changes: 5 additions & 4 deletions Standards_sharingCapability/run.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
param($tenant)
if ((Test-Path ".\Cache_Standards\$($Tenant).Standards.json")) {
$Setting = (Get-Content ".\Cache_Standards\$($Tenant).Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.sharingCapability
}

if (!$Setting) { $Setting = (Get-Content ".\Cache_Standards\AllTenants.Standards.json" -ErrorAction SilentlyContinue | ConvertFrom-Json -ErrorAction SilentlyContinue).standards.sharingCapability }
$ConfigTable = Get-CippTable -tablename 'standards'
$Setting = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq '$tenant'").JSON | ConvertFrom-Json).standards.sharingCapability
if (!$Setting) {
$Setting = ((Get-AzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'standards' and RowKey eq 'AllTenants'").JSON | ConvertFrom-Json).standards.sharingCapability
}

try {
New-GraphPostRequest -tenantid $tenant -Uri "https://graph.microsoft.com/beta/admin/sharepoint/settings" -AsApp $true -Type patch -Body "{`"sharingCapability`":`"$($Setting.Level)`"}" -ContentType "application/json"
Expand Down
2 changes: 1 addition & 1 deletion profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ try {
Disable-AzContextAutosave -Scope Process | Out-Null
}
catch {}
$SCRIPT:CippRoot = (Get-Item $PSScriptRoot).Parent.FullName
$ENV:CippRoot = (Get-Item $PSScriptRoot).FullName
# Uncomment the next line to enable legacy AzureRm alias in Azure PowerShell.
# Enable-AzureRmAlias

Expand Down

0 comments on commit f8c99ca

Please sign in to comment.