From f8c99ca42f0b897fb4654644e645cf20baeb23a3 Mon Sep 17 00:00:00 2001 From: Kelvin Tegelaar Date: Wed, 24 Aug 2022 12:41:58 +0200 Subject: [PATCH] testing path fix --- AddChocoApp/run.ps1 | 2 +- AddChocoApp_OrchestrationStarterTimer/run.ps1 | 1 - AddMSPApp/run.ps1 | 2 +- Applications_Upload/run.ps1 | 2 +- BestPracticeAnalyser_All/run.ps1 | 1 + BestPracticeAnalyser_GetQueue/run.ps1 | 2 +- BestPracticeAnalyser_OrchestrationStarter/run.ps1 | 1 - DomainAnalyser_List/run.ps1 | 2 +- DomainAnalyser_OrchestrationStarter/run.ps1 | 1 - Domain_OrchestrationStarterTimer/run.ps1 | 1 - ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1 | 1 - ExecMaintenanceScripts/run.ps1 | 2 +- ExecOffboardUser/run.ps1 | 2 +- ExecSAMSetup/run.ps1 | 2 +- GetVersion/run.ps1 | 2 +- GraphHelper.psm1 | 1 + ListCAtemplates/run.ps1 | 2 +- ListIntuneTemplates/run.ps1 | 2 +- ListLicenses/run.ps1 | 1 + ListLicensesAllTenants/run.ps1 | 2 +- ListSharepointSettings/run.ps1 | 2 +- ListStandards/run.ps1 | 2 +- ListUsers/run.ps1 | 1 + Standards_ExcludedfileExt/run.ps1 | 8 ++++---- Standards_MailContacts/run.ps1 | 8 ++++---- Standards_OauthConsent/run.ps1 | 9 ++++----- Standards_OrchestrationStarter/run.ps1 | 1 - Standards_sharingCapability/run.ps1 | 9 +++++---- profile.ps1 | 2 +- 29 files changed, 36 insertions(+), 38 deletions(-) diff --git a/AddChocoApp/run.ps1 b/AddChocoApp/run.ps1 index adfa3bf15e9e..1139354c4e4b 100644 --- a/AddChocoApp/run.ps1 +++ b/AddChocoApp/run.ps1 @@ -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 diff --git a/AddChocoApp_OrchestrationStarterTimer/run.ps1 b/AddChocoApp_OrchestrationStarterTimer/run.ps1 index e106bf6dd587..db6463ff1c29 100644 --- a/AddChocoApp_OrchestrationStarterTimer/run.ps1 +++ b/AddChocoApp_OrchestrationStarterTimer/run.ps1 @@ -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 diff --git a/AddMSPApp/run.ps1 b/AddMSPApp/run.ps1 index 8aa196653ca8..1fa8b0ea3a6c 100644 --- a/AddMSPApp/run.ps1 +++ b/AddMSPApp/run.ps1 @@ -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 diff --git a/Applications_Upload/run.ps1 b/Applications_Upload/run.ps1 index e15a3b3e6298..2ceb1afeb90c 100644 --- a/Applications_Upload/run.ps1 +++ b/Applications_Upload/run.ps1 @@ -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") { diff --git a/BestPracticeAnalyser_All/run.ps1 b/BestPracticeAnalyser_All/run.ps1 index 95823dc656a6..a295feb7ffcd 100644 --- a/BestPracticeAnalyser_All/run.ps1 +++ b/BestPracticeAnalyser_All/run.ps1 @@ -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 diff --git a/BestPracticeAnalyser_GetQueue/run.ps1 b/BestPracticeAnalyser_GetQueue/run.ps1 index 5a21ffb483b4..26fa13446540 100644 --- a/BestPracticeAnalyser_GetQueue/run.ps1 +++ b/BestPracticeAnalyser_GetQueue/run.ps1 @@ -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} diff --git a/BestPracticeAnalyser_OrchestrationStarter/run.ps1 b/BestPracticeAnalyser_OrchestrationStarter/run.ps1 index bb74b0c8a045..679c8aca1809 100644 --- a/BestPracticeAnalyser_OrchestrationStarter/run.ps1 +++ b/BestPracticeAnalyser_OrchestrationStarter/run.ps1 @@ -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 diff --git a/DomainAnalyser_List/run.ps1 b/DomainAnalyser_List/run.ps1 index 537e89e0f798..4b51f3542c66 100644 --- a/DomainAnalyser_List/run.ps1 +++ b/DomainAnalyser_List/run.ps1 @@ -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' diff --git a/DomainAnalyser_OrchestrationStarter/run.ps1 b/DomainAnalyser_OrchestrationStarter/run.ps1 index ef41afd6502c..7c85e87640cd 100644 --- a/DomainAnalyser_OrchestrationStarter/run.ps1 +++ b/DomainAnalyser_OrchestrationStarter/run.ps1 @@ -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 diff --git a/Domain_OrchestrationStarterTimer/run.ps1 b/Domain_OrchestrationStarterTimer/run.ps1 index 3b7e2069e6b4..67e945736bb1 100644 --- a/Domain_OrchestrationStarterTimer/run.ps1 +++ b/Domain_OrchestrationStarterTimer/run.ps1 @@ -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 diff --git a/ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1 b/ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1 index 5a90044cfe58..0621054242fd 100644 --- a/ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1 +++ b/ExecMaintenanceScripts/Scripts/Migrate-CippStorage.ps1 @@ -1,7 +1,6 @@ if (!(Get-Module -ListAvailable AzTable)) { Install-Module AzTable -Confirm:$false -Force } - $Logo = @' _____ _____ _____ _____ / ____|_ _| __ \| __ \ diff --git a/ExecMaintenanceScripts/run.ps1 b/ExecMaintenanceScripts/run.ps1 index 6974a74a35bd..750b68d71bbc 100644 --- a/ExecMaintenanceScripts/run.ps1 +++ b/ExecMaintenanceScripts/run.ps1 @@ -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 diff --git a/ExecOffboardUser/run.ps1 b/ExecOffboardUser/run.ps1 index 9f1389d4106b..22d5c564a4ba 100644 --- a/ExecOffboardUser/run.ps1 +++ b/ExecOffboardUser/run.ps1 @@ -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) diff --git a/ExecSAMSetup/run.ps1 b/ExecSAMSetup/run.ps1 index 490a03324f22..3ea14fce137c 100644 --- a/ExecSAMSetup/run.ps1 +++ b/ExecSAMSetup/run.ps1 @@ -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) diff --git a/GetVersion/run.ps1 b/GetVersion/run.ps1 index 001928ca7104..ddf7e0b78764 100644 --- a/GetVersion/run.ps1 +++ b/GetVersion/run.ps1 @@ -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" diff --git a/GraphHelper.psm1 b/GraphHelper.psm1 index 2bc1a9399b8b..3fcdba3e2502 100644 --- a/GraphHelper.psm1 +++ b/GraphHelper.psm1 @@ -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' } diff --git a/ListCAtemplates/run.ps1 b/ListCAtemplates/run.ps1 index d4a6f0233a3a..6f41645b40d5 100644 --- a/ListCAtemplates/run.ps1 +++ b/ListCAtemplates/run.ps1 @@ -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." diff --git a/ListIntuneTemplates/run.ps1 b/ListIntuneTemplates/run.ps1 index 1755893bb23d..af36d704835f 100644 --- a/ListIntuneTemplates/run.ps1 +++ b/ListIntuneTemplates/run.ps1 @@ -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' diff --git a/ListLicenses/run.ps1 b/ListLicenses/run.ps1 index 76d4a94bdb64..ce5f9fa84fcf 100644 --- a/ListLicenses/run.ps1 +++ b/ListLicenses/run.ps1 @@ -33,6 +33,7 @@ else { $GraphRequest = $Rows } } +Set-Location $ENV:CippRoot $ConvertTable = Import-Csv Conversiontable.csv if (!$GraphRequest) { $GraphRequest = foreach ($singlereq in $RawGraphRequest) { diff --git a/ListLicensesAllTenants/run.ps1 b/ListLicensesAllTenants/run.ps1 index 7a71966d629a..e3a90b8d05ca 100644 --- a/ListLicensesAllTenants/run.ps1 +++ b/ListLicensesAllTenants/run.ps1 @@ -26,7 +26,7 @@ $RawGraphRequest = Get-Tenants | ForEach-Object -Parallel { } } } - +Set-Location $ENV:CippRoot $ConvertTable = Import-Csv Conversiontable.csv $Table = Get-CIPPTable -TableName cachelicenses diff --git a/ListSharepointSettings/run.ps1 b/ListSharepointSettings/run.ps1 index a50213b067e2..1f99b97ca47d 100644 --- a/ListSharepointSettings/run.ps1 +++ b/ListSharepointSettings/run.ps1 @@ -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 { diff --git a/ListStandards/run.ps1 b/ListStandards/run.ps1 index 7a9fae01f81c..32cacb581063 100644 --- a/ListStandards/run.ps1 +++ b/ListStandards/run.ps1 @@ -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' diff --git a/ListUsers/run.ps1 b/ListUsers/run.ps1 index 8260b87cb2be..b090a4ce115f 100644 --- a/ListUsers/run.ps1 +++ b/ListUsers/run.ps1 @@ -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 diff --git a/Standards_ExcludedfileExt/run.ps1 b/Standards_ExcludedfileExt/run.ps1 index daa47d66d102..d46e9e2c6b2d 100644 --- a/Standards_ExcludedfileExt/run.ps1 +++ b/Standards_ExcludedfileExt/run.ps1 @@ -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) } diff --git a/Standards_MailContacts/run.ps1 b/Standards_MailContacts/run.ps1 index e0062f5cc4ec..17c3f3dbf40f 100644 --- a/Standards_MailContacts/run.ps1 +++ b/Standards_MailContacts/run.ps1 @@ -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]@{} diff --git a/Standards_OauthConsent/run.ps1 b/Standards_OauthConsent/run.ps1 index ceb14111f355..2de32a7c38fc 100644 --- a/Standards_OauthConsent/run.ps1 +++ b/Standards_OauthConsent/run.ps1 @@ -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) diff --git a/Standards_OrchestrationStarter/run.ps1 b/Standards_OrchestrationStarter/run.ps1 index 64eb2897bc16..514c3edf0980 100644 --- a/Standards_OrchestrationStarter/run.ps1 +++ b/Standards_OrchestrationStarter/run.ps1 @@ -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 diff --git a/Standards_sharingCapability/run.ps1 b/Standards_sharingCapability/run.ps1 index 520611e0df4a..e9b1cb89c2a6 100644 --- a/Standards_sharingCapability/run.ps1 +++ b/Standards_sharingCapability/run.ps1 @@ -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" diff --git a/profile.ps1 b/profile.ps1 index 2488c376477e..060ed7036564 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -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