Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoJUICT authored Oct 27, 2023
2 parents 964a97e + 1e056dd commit 64b925a
Show file tree
Hide file tree
Showing 280 changed files with 105,799 additions and 439 deletions.
2 changes: 1 addition & 1 deletion Activity_AddOrUpdateTableRows/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $Table = Get-CippTable -tablename $TableName
foreach ($param in $TableParams.Entity) {
try {
#Sending each item indivually, if it fails, log an error.
Add-AzDataTableEntity @Table -Entity $param -Force
Add-CIPPAzDataTableEntity @Table -Entity $param -Force
}
catch {
Write-LogMessage -API 'Activity_AddOrUpdateTableRows' -message "Unable to write to '$($TableParams.TableName)' Using RowKey $($param.RowKey) table: $($_.Exception.Message)" -sev error
Expand Down
2 changes: 1 addition & 1 deletion Activity_GetAllTableRows/run.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
param($name)

$Table = Get-CippTable -tablename $name
$Rows = Get-AzDataTableEntity @Table
$Rows = Get-CIPPAzDataTableEntity @Table

Write-Output $Rows
2 changes: 1 addition & 1 deletion AddAlert/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $Results = foreach ($Tenant in $tenants) {
}

$Table = get-cipptable -TableName 'SchedulerConfig'
Add-AzDataTableEntity @Table -Entity $CompleteObject -Force
Add-CIPPAzDataTableEntity @Table -Entity $CompleteObject -Force
}
$URL = ($request.headers.'x-ms-original-url').split('/api') | Select-Object -First 1
if ($Tenant -eq 'AllTenants') {
Expand Down
2 changes: 1 addition & 1 deletion AddCATemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ try {
$JSON = ($JSON | ConvertTo-Json -Depth 100)
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$JSON"
RowKey = "$GUID"
PartitionKey = "CATemplate"
Expand Down
2 changes: 1 addition & 1 deletion AddChocoApp/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $Results = foreach ($Tenant in $tenants) {
} | ConvertTo-Json -Depth 15
$Table = Get-CippTable -tablename 'apps'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$CompleteObject"
RowKey = "$((New-Guid).GUID)"
PartitionKey = "apps"
Expand Down
2 changes: 1 addition & 1 deletion AddExConnectorTemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ try {
$JSON = ($JSON | Select-Object @{n = 'name'; e = { $_.name } }, * | ConvertTo-Json -Depth 10)
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$json"
RowKey = "$GUID"
direction = $request.body.cippconnectortype
Expand Down
2 changes: 1 addition & 1 deletion AddGroupTemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ try {
} | ConvertTo-Json
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$object"
RowKey = "$GUID"
PartitionKey = "GroupTemplate"
Expand Down
4 changes: 2 additions & 2 deletions AddIntuneTemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
} | ConvertTo-Json
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$object"
RowKey = "$GUID"
PartitionKey = "IntuneTemplate"
Expand Down Expand Up @@ -99,7 +99,7 @@ try {
} | ConvertTo-Json
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$object"
RowKey = "$GUID"
PartitionKey = "IntuneTemplate"
Expand Down
2 changes: 1 addition & 1 deletion AddMSPApp/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $Results = foreach ($Tenant in $tenants) {
} | ConvertTo-Json -Depth 15
$Table = Get-CippTable -tablename 'apps'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$CompleteObject"
RowKey = "$((New-Guid).GUID)"
PartitionKey = "apps"
Expand Down
4 changes: 1 addition & 3 deletions AddPolicy/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ $results = foreach ($Tenant in $tenants) {
}
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($Tenant) -message "Added policy $($Displayname)" -Sev "Error"
if ($AssignTo) {
$AssignBody = if ($AssignTo -ne "AllDevicesAndUsers") { '{"assignments":[{"id":"","target":{"@odata.type":"#microsoft.graph.' + $($AssignTo) + 'AssignmentTarget"}}]}' } else { '{"assignments":[{"id":"","target":{"@odata.type":"#microsoft.graph.allDevicesAssignmentTarget"}},{"id":"","target":{"@odata.type":"#microsoft.graph.allLicensedUsersAssignmentTarget"}}]}' }
$assign = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL('$($CreateRequest.id)')/assign" -tenantid $tenant -type POST -body $AssignBody
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($Tenant) -message "Assigned policy $($Displayname) to $AssignTo" -Sev "Info"
Set-CIPPAssignedPolicy -GroupName $AssignTo -PolicyId $CreateRequest.id -Type $TemplateTypeURL -TenantFilter $tenant
}
"Successfully added policy for $($Tenant)"
}
Expand Down
2 changes: 1 addition & 1 deletion AddScheduledItem/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $entity = @{
Results = 'Planned'
}
Write-Host "entity: $($entity | ConvertTo-Json)"
Add-AzDataTableEntity @Table -Entity $entity
Add-CIPPAzDataTableEntity @Table -Entity $entity
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = @{ Results = 'Task added successfully.' }
Expand Down
2 changes: 1 addition & 1 deletion AddSpamFilterTemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
$JSON = ($JSON | Select-Object @{n = 'name'; e = { $_.name } }, @{n = 'comments'; e = { $_.comments } }, * | ConvertTo-Json -Depth 10)
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$json"
RowKey = "$GUID"
PartitionKey = "SpamfilterTemplate"
Expand Down
2 changes: 1 addition & 1 deletion AddStandardsDeploy/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
} | ConvertTo-Json -Depth 10
$Table = Get-CippTable -tablename 'standards'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$object"
RowKey = "$Tenant"
PartitionKey = "standards"
Expand Down
2 changes: 1 addition & 1 deletion AddTransportTemplate/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
$JSON = ($JSON | Select-Object @{n = 'name'; e = { $_.name } }, @{n = 'comments'; e = { $_.comments } }, * | ConvertTo-Json -Depth 10)
$Table = Get-CippTable -tablename 'templates'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$json"
RowKey = "$GUID"
PartitionKey = "TransportTemplate"
Expand Down
2 changes: 1 addition & 1 deletion AddWinGetApp/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $Results = foreach ($Tenant in $tenants) {
} | ConvertTo-Json -Depth 15
$Table = Get-CippTable -tablename 'apps'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$CompleteObject"
RowKey = "$((New-Guid).GUID)"
PartitionKey = "apps"
Expand Down
2 changes: 1 addition & 1 deletion Applications_GetQueue/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ param($name)

$Table = Get-CippTable -tablename 'apps'

$Object = (Get-AzDataTableEntity @Table).RowKey
$Object = (Get-CIPPAzDataTableEntity @Table).RowKey
$object
15 changes: 6 additions & 9 deletions Applications_Upload/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ param($name)
$Table = Get-CippTable -tablename 'apps'
$Filter = "PartitionKey eq 'apps' and RowKey eq '$name'"
Set-Location (Get-Item $PSScriptRoot).Parent.FullName
$ChocoApp = (Get-AzDataTableEntity @Table -filter $Filter).JSON | ConvertFrom-Json
$ChocoApp = (Get-CIPPAzDataTableEntity @Table -filter $Filter).JSON | ConvertFrom-Json
$intuneBody = $ChocoApp.IntuneBody
$tenants = if ($chocoapp.Tenant -eq "AllTenants") {
(Get-tenants).defaultDomainName
Expand All @@ -28,13 +28,13 @@ $ContentBody = ConvertTo-Json @{
size = [int64]$intunexml.ApplicationInfo.UnencryptedContentSize
sizeEncrypted = [int64]($intunewinFilesize).length
}
$ClearRow = Get-AzDataTableEntity @Table -Filter $Filter
$ClearRow = Get-CIPPAzDataTableEntity @Table -Filter $Filter
$RemoveCacheFile = if ($chocoapp.Tenant -ne "AllTenants") {
Remove-AzDataTableEntity @Table -Entity $clearRow
}
else {
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
JSON = "$($ChocoApp | ConvertTo-Json)"
RowKey = "$($ClearRow.RowKey)"
PartitionKey = "apps"
Expand Down Expand Up @@ -69,9 +69,7 @@ foreach ($tenant in $tenants) {
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "$($ChocoApp.ApplicationName) uploaded as WinGet app." -Sev "Info"
if ($AssignTo -ne "On") {
$intent = if ($AssignToIntent) { 'Uninstall' } else { 'Required' }
$AssignBody = if ($AssignTo -ne "AllDevicesAndUsers") { '{"mobileAppAssignments":[{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.' + $($AssignTo) + 'AssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.winGetAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null}}]}' } else { '{"mobileAppAssignments":[{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.allDevicesAssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.winGetAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null}},{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.allLicensedUsersAssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.winGetAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null}}]}' }
$assign = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/$($NewApp.id)/assign" -tenantid $tenant -type POST -body $AssignBody
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "Assigned application $($chocoApp.ApplicationName) to $AssignTo" -Sev "Info"
Set-CIPPAssignedApplication -ApplicationId $NewApp.Id -Intent $intent -TenantFilter $tenant -groupName "$AssignTo" -AppType "WinGet"
}
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "$($ChocoApp.ApplicationName) Successfully created" -Sev "Info"
exit 0
Expand Down Expand Up @@ -108,9 +106,8 @@ foreach ($tenant in $tenants) {
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "Added Application $($chocoApp.ApplicationName)" -Sev "Info"
if ($AssignTo -ne "On") {
$intent = if ($AssignToIntent) { 'Uninstall' } else { 'Required' }
$AssignBody = if ($AssignTo -ne "AllDevicesAndUsers") { '{"mobileAppAssignments":[{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.' + $($AssignTo) + 'AssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.win32LobAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null,"deliveryOptimizationPriority":"notConfigured"}}]}' } else { '{"mobileAppAssignments":[{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.allDevicesAssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.win32LobAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null,"deliveryOptimizationPriority":"notConfigured"}},{"@odata.type":"#microsoft.graph.mobileAppAssignment","target":{"@odata.type":"#microsoft.graph.allLicensedUsersAssignmentTarget"},"intent":"' + $($intent) + '","settings":{"@odata.type":"#microsoft.graph.win32LobAppAssignmentSettings","notifications":"hideAll","installTimeSettings":null,"restartSettings":null,"deliveryOptimizationPriority":"notConfigured"}}]}' }
$assign = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/$($NewApp.id)/assign" -tenantid $tenant -type POST -body $AssignBody
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "Assigned application $($chocoApp.ApplicationName) to $AssignTo" -Sev "Info"
Set-CIPPAssignedApplication -ApplicationId $NewApp.Id -Intent $intent -TenantFilter $tenant -groupName "$AssignTo" -AppType "Win32Lob"

}
Write-LogMessage -api "AppUpload" -tenant $($Tenant) -message "Successfully added Application" -Sev "Info"
}
Expand Down
2 changes: 1 addition & 1 deletion BestPracticeAnalyser_All/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ $AddRow = foreach ($Template in $templates) {

if ($Result) {
try {
Add-AzDataTableEntity @Table -Entity $Result -Force
Add-CIPPAzDataTableEntity @Table -Entity $Result -Force
} catch {
Write-LogMessage -API 'BPA' -tenant $tenant -message "Error getting saving data for $($template.Name) - $($TenantName.customerId). Error: $($_.Exception.Message)" -sev Error

Expand Down
2 changes: 1 addition & 1 deletion BestPracticeAnalyser_List/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -

$Tenants = Get-Tenants
$Table = get-cipptable 'cachebpa'
$Results = (Get-AzDataTableEntity @Table) | ForEach-Object {
$Results = (Get-CIPPAzDataTableEntity @Table) | ForEach-Object {
$_.UnusedLicenseList = @(ConvertFrom-Json -ErrorAction silentlycontinue -InputObject $_.UnusedLicenseList)
$_
}
Expand Down
1 change: 1 addition & 0 deletions Cache_SAMSetup/SAMManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
{ "id": "338163d7-f101-4c92-94ba-ca46fe52447c", "type": "Role" },
{ "id": "cac88765-0581-4025-9725-5ebc13f729ee", "type": "Role" },
{ "id": "75359482-378d-4052-8f01-80520e7db3cd", "type": "Role" },
{ "id": "19dbc75e-c2e2-444c-a770-ec69d8559fc7", "type": "Role" },
{ "id": "b27a61ec-b99c-4d6a-b126-c4375d08ae30", "type": "Scope" },
{ "id": "84bccea3-f856-4a8a-967b-dbe0a3d53a64", "type": "Scope" },
{ "id": "280b3b69-0437-44b1-bc20-3b2fca1ee3e9", "type": "Scope" },
Expand Down
4 changes: 2 additions & 2 deletions DomainAnalyser_All/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Import-Module DNSHealth
try {
$ConfigTable = Get-CippTable -tablename Config
$Filter = "PartitionKey eq 'Domains' and RowKey eq 'Domains'"
$Config = Get-AzDataTableEntity @ConfigTable -Filter $Filter
$Config = Get-CIPPAzDataTableEntity @ConfigTable -Filter $Filter

$ValidResolvers = @('Google', 'CloudFlare', 'Quad9')
if ($ValidResolvers -contains $Config.Resolver) {
Expand All @@ -18,7 +18,7 @@ try {
RowKey = 'Domains'
Resolver = $Resolver
}
Add-AzDataTableEntity @ConfigTable -Entity $Config -Force
Add-CIPPAzDataTableEntity @ConfigTable -Entity $Config -Force
}
}
catch {
Expand Down
8 changes: 4 additions & 4 deletions DomainAnalyser_GetTenantDomains/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $TenantDomains = $Tenants | ForEach-Object -Parallel {
# Cleanup domains from tenants with errors, skip domains with manually set selectors or mail providers
foreach ($Exclude in $ExcludedTenants) {
$Filter = "PartitionKey eq 'TenantDomains' and TenantId eq '{0}'" -f $Exclude.defaultDomainName
$CleanupRows = Get-AzDataTableEntity @DomainTable -Filter $Filter
$CleanupRows = Get-CIPPAzDataTableEntity @DomainTable -Filter $Filter
$CleanupCount = ($CleanupRows | Measure-Object).Count
if ($CleanupCount -gt 0) {
Write-LogMessage -API 'DomainAnalyser' -tenant $Exclude.defaultDomainName -message "Cleaning up $CleanupCount domain(s) for excluded tenant" -sev Info
Expand All @@ -48,14 +48,14 @@ if ($TenantCount -gt 0) {
$TenantDomainObjects = foreach ($Tenant in $TenantDomains) {
$TenantDetails = ($Tenant | ConvertTo-Json -Compress).ToString()
$Filter = "PartitionKey eq '{0}' and RowKey eq '{1}'" -f $Tenant.Tenant, $Tenant.Domain
$OldDomain = Get-AzDataTableEntity @DomainTable -Filter $Filter
$OldDomain = Get-CIPPAzDataTableEntity @DomainTable -Filter $Filter

if ($OldDomain) {
Remove-AzDataTableEntity @DomainTable -Entity $OldDomain | Out-Null
}

$Filter = "PartitionKey eq 'TenantDomains' and RowKey eq '{0}'" -f $Tenant.Domain
$Domain = Get-AzDataTableEntity @DomainTable -Filter $Filter
$Domain = Get-CIPPAzDataTableEntity @DomainTable -Filter $Filter

if (!$Domain) {
$DomainObject = [pscustomobject]@{
Expand Down Expand Up @@ -86,7 +86,7 @@ if ($TenantCount -gt 0) {

# Batch insert all tenant domains
try {
Add-AzDataTableEntity @DomainTable -Entity $TenantDomainObjects -Force
Add-CIPPAzDataTableEntity @DomainTable -Entity $TenantDomainObjects -Force
} catch { Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser GetTenantDomains Error $($_.Exception.Message)" -sev info }
} catch { Write-LogMessage -API 'DomainAnalyser' -message "GetTenantDomains loop exception: $($_.Exception.Message) line $($_.InvocationInfo.ScriptLineNumber)" -sev 'Error' }
}
2 changes: 1 addition & 1 deletion DomainAnalyser_List/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if ($Request.Query.tenantFilter -ne 'AllTenants') {

try {
# Extract json from table results
$Results = foreach ($DomainAnalyserResult in (Get-AzDataTableEntity @DomainTable).DomainAnalyser) {
$Results = foreach ($DomainAnalyserResult in (Get-CIPPAzDataTableEntity @DomainTable).DomainAnalyser) {
try {
if (![string]::IsNullOrEmpty($DomainAnalyserResult)) {
$Object = $DomainAnalyserResult | ConvertFrom-Json
Expand Down
2 changes: 1 addition & 1 deletion Durable_BECRun/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ catch {

$Table = Get-CippTable -tablename 'cachebec'
$Table.Force = $true
Add-AzDataTableEntity @Table -Entity @{
Add-CIPPAzDataTableEntity @Table -Entity @{
UserId = $Context.input.userid
Results = "$($results | ConvertTo-Json -Depth 10)"
RowKey = $Context.input.userid
Expand Down
2 changes: 1 addition & 1 deletion EditTenant/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if ($tenantObjectId) {
$Filter = "PartitionKey eq 'Tenants' and defaultDomainName eq '{0}'" -f $tenantDefaultDomainName
try {
$TenantsTable = Get-CippTable -tablename Tenants
$Tenant = Get-AzDataTableEntity @TenantsTable -Filter $Filter
$Tenant = Get-CIPPAzDataTableEntity @TenantsTable -Filter $Filter
$Tenant.displayName = $tenantDisplayName
Update-AzDataTableEntity @TenantsTable -Entity $Tenant
}
Expand Down
Loading

0 comments on commit 64b925a

Please sign in to comment.