Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to hotfix #966

Merged
merged 175 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
c982cb2
Merge pull request #77 from KelvinTegelaar/dev
BNWEIN Jun 22, 2024
62b7b0e
Merge pull request #78 from KelvinTegelaar/dev
BNWEIN Jun 23, 2024
afa25ec
Create Invoke-ListGroupSenderAuthentication.ps1
BNWEIN Jun 23, 2024
d1a3155
Update Invoke-ListGroupSenderAuthentication.ps1
BNWEIN Jun 23, 2024
de594e0
Updated Anti-Phishing Policy Standards for more granular configuration
cipptesting Jun 24, 2024
8be3108
Fixed Invoke-CIPPStandardAntiPhishPolicy.ps1
cipptesting Jun 25, 2024
764c4c7
Add Litigation Hold Standard
chase-vgo Jun 25, 2024
7dd0eb7
Add excluded tenant info to onboarding
JohnDuprey Jun 26, 2024
112f75f
Merge pull request #79 from KelvinTegelaar/dev
BNWEIN Jun 26, 2024
46f9dad
Update Invoke-ListGroupSenderAuthentication.ps1
BNWEIN Jun 26, 2024
39fcd4f
Merge pull request #66 from KelvinTegelaar/dev
kris6673 Jun 26, 2024
531d24f
Merge branch 'KelvinTegelaar:dev' into dev
BNWEIN Jun 26, 2024
46671ff
Moved to Set-CIPPForwarding Function
BNWEIN Jun 27, 2024
5cd9612
Edits
BNWEIN Jun 27, 2024
00f713d
Update Invoke-ExecMailboxRestore.ps1
BNWEIN Jun 27, 2024
ce8479a
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jun 28, 2024
2d3414c
Update Invoke-ListMailboxes.ps1
BNWEIN Jun 28, 2024
0e959bf
New UserReportDestinationEmail standard
kris6673 Jun 28, 2024
f28388c
Merge pull request #924 from kris6673/userreportsentto
KelvinTegelaar Jun 28, 2024
f736d6e
Merge pull request #919 from chase-vgo/dev
KelvinTegelaar Jun 28, 2024
f196604
Merge pull request #923 from BNWEIN/dev
KelvinTegelaar Jun 28, 2024
77f933c
cleanup
KelvinTegelaar Jun 28, 2024
16b4bff
Limit query to contentTypes that are in rules
JohnDuprey Jun 28, 2024
6b15497
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jun 28, 2024
2470a7d
Merge pull request #913 from cipptesting/dev
KelvinTegelaar Jun 28, 2024
cb6e1ad
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jun 28, 2024
27432de
Merge pull request #926 from JohnDuprey/dev
JohnDuprey Jun 28, 2024
0545601
Add OneDrive Pre-Provision
JohnDuprey Jun 30, 2024
a7c90fb
Merge pull request #927 from JohnDuprey/dev
JohnDuprey Jun 30, 2024
fabe2dc
Fix bug with TAP
JohnDuprey Jul 1, 2024
9ca69a7
Add includeerrors for Ninja orgs tenant map
JohnDuprey Jul 1, 2024
2092252
Add HuduAPI module
JohnDuprey Jul 1, 2024
2192b11
Multiple Changes
BNWEIN Jul 2, 2024
1d1dd05
Hudu extension
JohnDuprey Jul 2, 2024
ebc91fc
tweak ListMailboxes
JohnDuprey Jul 2, 2024
cef4e28
Merge pull request #929 from JohnDuprey/dev
JohnDuprey Jul 2, 2024
f229fd4
Extension fix - CIPP-API
JohnDuprey Jul 2, 2024
414e7ad
Update Invoke-ExecExtensionsConfig.ps1
JohnDuprey Jul 2, 2024
dc588a2
Update Invoke-ExecExtensionsConfig.ps1
JohnDuprey Jul 2, 2024
590248b
Merge pull request #70 from KelvinTegelaar/dev
kris6673 Jul 2, 2024
f1aa778
Tool script to add standards documentation based on the JSON in the f…
kris6673 Jul 2, 2024
75aded8
Whoops, copy paste mistake
kris6673 Jul 2, 2024
5cdb383
Add check if file is not found
kris6673 Jul 2, 2024
7d854a3
Add how to update the comment blocks
kris6673 Jul 2, 2024
4d6d080
Update comment blocks and add standards documentation based on JSON
kris6673 Jul 2, 2024
1907482
fix patching issue
KelvinTegelaar Jul 3, 2024
e40a128
fixes updates to groups.
KelvinTegelaar Jul 3, 2024
e9dcf68
Merge pull request #928 from BNWEIN/dev
KelvinTegelaar Jul 3, 2024
b8568d0
Merge pull request #930 from kris6673/auto-docs-standards
KelvinTegelaar Jul 3, 2024
a5f0476
Adding self-service license management Standard
Jul 3, 2024
79b05a4
Update Invoke-CIPPStandardEnableLitigationHold.ps1
chase-vgo Jul 3, 2024
4c46034
Always said disable even if delete was chosen as the expireaction
kris6673 Jul 3, 2024
2b721d4
Standardize Extension Output and Mappings
JohnDuprey Jul 3, 2024
9681e66
Typos
JohnDuprey Jul 3, 2024
92c3496
Merge pull request #210 from KelvinTegelaar/dev
JohnDuprey Jul 3, 2024
bd91705
Merge pull request #936 from JohnDuprey/dev
JohnDuprey Jul 3, 2024
3492c3d
Merge branch 'dev' of https://github.com/johnduprey/CIPP-API into dev
JohnDuprey Jul 3, 2024
6921c77
Reset graph error count on successful query
JohnDuprey Jul 3, 2024
d633ad7
added backups
KelvinTegelaar Jul 4, 2024
169cf66
improvements createbackup
KelvinTegelaar Jul 4, 2024
17d2fd4
Merge pull request #935 from kris6673/dev
KelvinTegelaar Jul 5, 2024
1e0fcc4
Merge pull request #934 from chase-vgo/dev
KelvinTegelaar Jul 5, 2024
d9b8271
Merge pull request #933 from rvdwegen/dev
KelvinTegelaar Jul 5, 2024
659e045
Merge pull request #932 from BNWEIN/EditGroupChanges
KelvinTegelaar Jul 5, 2024
6a5a37d
fixes external sender
KelvinTegelaar Jul 5, 2024
988c08c
fixes issue if there are no known locations or apps.
KelvinTegelaar Jul 5, 2024
5b2fde3
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 5, 2024
b323911
Sharepoint functions
JohnDuprey Jul 5, 2024
d9495df
Merge pull request #939 from JohnDuprey/dev
JohnDuprey Jul 5, 2024
64cd240
Update Set-CIPPSPOTenant.ps1
JohnDuprey Jul 5, 2024
93f0ebb
generate siteid
KelvinTegelaar Jul 5, 2024
6e0cfeb
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Jul 5, 2024
ed2378f
CPV tweaks
JohnDuprey Jul 5, 2024
634f645
convert to string for backup tasks
KelvinTegelaar Jul 5, 2024
ca3b627
fixes backup list
KelvinTegelaar Jul 5, 2024
c355a54
Extension data sync
JohnDuprey Jul 6, 2024
d8121a7
Merge pull request #212 from KelvinTegelaar/dev
JohnDuprey Jul 6, 2024
b7d1f66
Merge pull request #940 from JohnDuprey/dev
JohnDuprey Jul 6, 2024
0e429f0
Update CPV to work with partner tenant
JohnDuprey Jul 6, 2024
ca49fe9
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 6, 2024
e3bb4d3
Remove-CIPPCalendarInvites
chase-vgo Jul 6, 2024
48edf0b
Merge branch 'KelvinTegelaar:dev' into dev
chase-vgo Jul 6, 2024
2aa3788
Added removeCalendarInvites
chase-vgo Jul 6, 2024
fdb9dfc
Roles for modifying calendar invites
chase-vgo Jul 6, 2024
b501988
Roles for removing calendar invites
chase-vgo Jul 6, 2024
de6d14e
Roles for removing calendar invites
chase-vgo Jul 6, 2024
24a77cb
Roles for removing calendar invites
chase-vgo Jul 6, 2024
a76ac09
commiting changes to copy app wizard.
KelvinTegelaar Jul 7, 2024
e0ffa58
major update to splitting data across tables
KelvinTegelaar Jul 7, 2024
8f88e9d
Improve storing large storage
KelvinTegelaar Jul 8, 2024
763035d
Added SPAzureB2B Standard
OfficialEsco Jul 5, 2024
a20b7df
Merge pull request #941 from chase-vgo/dev
KelvinTegelaar Jul 8, 2024
a40ce11
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 8, 2024
1318d8f
Added SPDirectSharing Standard
OfficialEsco Jul 5, 2024
10d330b
Added SPExternalUserExpiration standard
OfficialEsco Jul 8, 2024
0393b2b
Added SPEmailAttestation standard
OfficialEsco Jul 8, 2024
a7da0b1
Added SPDisallowInfectedFiles standard
OfficialEsco Jul 8, 2024
68f1247
fixed issue with entityid
KelvinTegelaar Jul 8, 2024
5d41fd3
Create extensions.json
OfficialEsco Jul 8, 2024
09931d9
fixesd backup data
KelvinTegelaar Jul 8, 2024
6390541
Merge pull request #71 from KelvinTegelaar/dev
kris6673 Jul 8, 2024
eba7ecf
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 8, 2024
6293cf0
Update Comments
OfficialEsco Jul 8, 2024
f2dc8f5
Hudu Extension
JohnDuprey Jul 8, 2024
d307b08
Update Initialize-DevEnvironment.ps1
JohnDuprey Jul 8, 2024
8cc64b0
Merge pull request #945 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
ebcf35f
Create extension specific jobs
JohnDuprey Jul 8, 2024
fa7de01
Use error message
kris6673 Jul 8, 2024
c15dd01
Extension sync tweaks
JohnDuprey Jul 8, 2024
5cc9f6d
Fix recurrence
JohnDuprey Jul 8, 2024
cd97efa
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Jul 8, 2024
c4339e3
Merge pull request #946 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
99b0b15
Add cleanup
JohnDuprey Jul 8, 2024
f8e5089
Merge branch 'dev' of https://github.com/johnduprey/CIPP-API into dev
JohnDuprey Jul 8, 2024
22e9530
Better comment block to support Get-Help
kris6673 Jul 8, 2024
b018e21
Hudu sync tweaks
JohnDuprey Jul 8, 2024
cd1ce2b
Merge pull request #948 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
3e1ded4
Add task registration to mapping save
JohnDuprey Jul 8, 2024
c325129
Merge pull request #949 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
3bb72cf
Fix hudu CIPP url
JohnDuprey Jul 8, 2024
689c5b7
Merge pull request #950 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
ff27f5f
Fix links
JohnDuprey Jul 8, 2024
5c9bb21
Merge branch 'dev' of https://github.com/johnduprey/CIPP-API into dev
JohnDuprey Jul 8, 2024
0195563
Merge pull request #951 from JohnDuprey/dev
JohnDuprey Jul 8, 2024
5885d69
finishing touches backup config
KelvinTegelaar Jul 8, 2024
bc01709
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Jul 8, 2024
1d95b2f
Hash contents for reduced api calls
JohnDuprey Jul 9, 2024
e25b94c
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Jul 9, 2024
9fb2dc1
Merge pull request #952 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
f030ea9
Update Invoke-ExecExtensionSync.ps1
JohnDuprey Jul 9, 2024
019cb45
Merge pull request #953 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
3b459e6
fix keepcopy
KelvinTegelaar Jul 9, 2024
c773001
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Jul 9, 2024
7477ccf
fixes minor issues with backup wizard
KelvinTegelaar Jul 9, 2024
c037f4d
finished restore settings
KelvinTegelaar Jul 9, 2024
e6630a0
add adbility to not allow duplicate names
KelvinTegelaar Jul 9, 2024
a66d8d9
fixed extended ignore list
KelvinTegelaar Jul 9, 2024
75cb2ce
Fix cleanup sync tasks and az table function
JohnDuprey Jul 9, 2024
6613778
Merge pull request #942 from Ren-Roros-Digital/SPOStandards
KelvinTegelaar Jul 9, 2024
6eb0403
Merge pull request #944 from Ren-Roros-Digital/vscode-recommend
KelvinTegelaar Jul 9, 2024
624fdd4
Merge pull request #947 from kris6673/comment-based-help-fixed-tm
KelvinTegelaar Jul 9, 2024
9bcf941
Extension sync - add mailbox permission/usage/cas
JohnDuprey Jul 9, 2024
08104e9
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 9, 2024
10c62de
Merge remote-tracking branch 'upstream/dev' into dev
JohnDuprey Jul 9, 2024
8ec917e
Merge pull request #954 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
e17e01a
Remove license asset field map
JohnDuprey Jul 9, 2024
ec3ac66
Merge pull request #955 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
75cc04b
Add logging
JohnDuprey Jul 9, 2024
f47e670
Merge branch 'KelvinTegelaar:dev' into dev
JohnDuprey Jul 9, 2024
20b59a2
Merge pull request #956 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
00b7c74
Update Invoke-ExecExtensionsConfig.ps1
JohnDuprey Jul 9, 2024
941f64e
Merge pull request #957 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
26de451
Update Invoke-ExecExtensionsConfig.ps1
JohnDuprey Jul 9, 2024
98a62a3
Merge pull request #958 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
ba5cd7f
Update Invoke-ExecExtensionsConfig.ps1
JohnDuprey Jul 9, 2024
303cab6
Merge pull request #959 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
8dd8847
Update Invoke-HuduExtensionSync.ps1
JohnDuprey Jul 9, 2024
16f98b3
Merge pull request #960 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
9db8b8a
temporary fix
KelvinTegelaar Jul 9, 2024
a880904
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Jul 9, 2024
4456769
Update Sync-CippExtensionData.ps1
JohnDuprey Jul 9, 2024
c2b8b61
Merge branch 'dev' of https://github.com/johnduprey/CIPP-API into dev
JohnDuprey Jul 9, 2024
2162ccf
Merge branch 'dev' of https://github.com/johnduprey/CIPP-API into dev
JohnDuprey Jul 9, 2024
d51e263
Merge pull request #961 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
d0de6ab
Fix CIPP links
JohnDuprey Jul 9, 2024
57eb0cb
Merge pull request #962 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
5161648
Fix onedrive data
JohnDuprey Jul 9, 2024
6545614
Merge pull request #963 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
0ae2de5
removed += for bobby
KelvinTegelaar Jul 9, 2024
14972dd
Improve DeletedUserRentention standard
kris6673 Jul 9, 2024
7a6e3d7
Handle pre v5.10.0
kris6673 Jul 9, 2024
50eaa5c
prettification
JohnDuprey Jul 9, 2024
eaab728
Merge pull request #965 from JohnDuprey/dev
JohnDuprey Jul 9, 2024
e75212a
Merge pull request #964 from kris6673/dev
KelvinTegelaar Jul 9, 2024
c0819e8
version up
KelvinTegelaar Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"editorconfig.editorconfig"
]
}
38 changes: 36 additions & 2 deletions Cache_SAMSetup/PermissionsTranslator.json
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,15 @@
"description": "Allows the app to create, read, update, and delete events of all calendars without a signed-in user.",
"displayName": "Read and write calendars in all mailboxes",
"id": "ef54d2bf-783f-4e0f-bca1-3210c0444d99",
"origin": "Application",
"value": "Calendars.ReadWrite"
"origin": "Application (Office 365 Exchange Online)",
"value": "Calendars.ReadWrite.All"
},
{
"description": "Allows the app to create, read, update, and delete user's mailbox settings without a signed-in user. Does not include permission to send mail.",
"displayName": "Read and write all user mailbox settings",
"id": "f9156939-25cd-4ba8-abfe-7fabcf003749",
"origin": "Application (Office 365 Exchange Online)",
"value": "Mailbox.Settings.ReadWrite"
},
{
"description": "Allows the app to read your organization's user flows, without a signed-in user.",
Expand Down Expand Up @@ -5286,6 +5293,24 @@
"userConsentDisplayName": "Read Threat and Vulnerability Management vulnerability information",
"value": "Exchange.Manage"
},
{
"description": "Allows the app to create, read, update and delete events in all calendars in the organization user has permissions to access. This includes delegate and shared calendars",
"displayName": "Read and write user and shared calendars",
"id": "bbd1ca91-75e0-4814-ad94-9c5dbbae3415",
"Origin": "Delegated (Office 365 Exchange Online)",
"userConsentDescription": "Allows the app to read, update, create and delete events in all calendars in your organization you have permissions to access. This includes delegate and shared calendars",
"userConsentDisplayName": "Read and write to your and shared calendars",
"value": "Calendars.ReadWrite.All"
},
{
"description": "Allows the app to create, read, update, and delete user's mailbox settings. Does not include permission to send mail.",
"displayName": "Read and write user mailbox settings",
"id": "2e83d72d-8895-4b66-9eea-abb43449ab8b",
"Origin": "Delegated (Office 365 Exchange Online)",
"userConsentDescription": "Allows the app to read, update, create, and delete your mailbox settings.",
"userConsentDisplayName": "Read and write to your mailbox settings",
"value": "MailboxSettings.ReadWrite"
},
{
"description": "Allows the app to have full control of all site collections on behalf of the signed-in user.",
"displayName": "Manage Sharepoint Online",
Expand All @@ -5312,5 +5337,14 @@
"userConsentDescription": "Access Microsoft Teams and Skype for Business data as the signed in user",
"userConsentDisplayName": "Access Microsoft Teams and Skype for Business data based on the user's role membership",
"value": "user_impersonation"
},
{
"description": "Read and write all on-premises directory synchronization information",
"displayName": "Read and write all on-premises directory synchronization information",
"id": "c2d95988-7604-4ba1-aaed-38a5f82a51c7",
"Origin": "Delegated",
"userConsentDescription": "Access Microsoft Teams and Skype for Business data as the signed in user",
"userConsentDisplayName": "Access Microsoft Teams and Skype for Business data based on the user's role membership",
"value": "OnPremDirectorySynchronization.ReadWrite.All"
}
]
12 changes: 11 additions & 1 deletion Cache_SAMSetup/SAMManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
]
},
"requiredResourceAccess": [
{
"resourceAppId": "aeb86249-8ea3-49e2-900b-54cc8e308f85",
"resourceAccess": [
{ "id": "fc946a4f-bc4d-413b-a090-b2c86113ec4f", "type": "Scope" }
]
},
{
"resourceAppId": "fa3d9a0c-3fb0-42cc-9193-47c7ecd2edbd",
"resourceAccess": [
Expand Down Expand Up @@ -159,7 +165,11 @@
"resourceAppId": "00000002-0000-0ff1-ce00-000000000000",
"resourceAccess": [
{ "id": "ab4f2b77-0b06-4fc1-a9de-02113fc2ab7c", "type": "Scope" },
{ "id": "dc50a0fb-09a3-484d-be87-e023b12c6440", "type": "Role" }
{ "id": "bbd1ca91-75e0-4814-ad94-9c5dbbae3415", "type": "Scope" },
{ "id": "2e83d72d-8895-4b66-9eea-abb43449ab8b", "type": "Scope" },
{ "id": "dc50a0fb-09a3-484d-be87-e023b12c6440", "type": "Role" },
{ "id": "ef54d2bf-783f-4e0f-bca1-3210c0444d99", "type": "Role" },
{ "id": "f9156939-25cd-4ba8-abfe-7fabcf003749", "type": "Role" }
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions Durable_BECRun/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Write-Host "Working on $UserName"
try {
$startDate = (Get-Date).AddDays(-7)
$endDate = (Get-Date)
$auditLog = (New-ExoRequest -tenantid $Tenantfilter -cmdlet 'Get-AdminAuditLogConfig').UnifiedAuditLogIngestionEnabled
$auditLog = (New-ExoRequest -tenantid $Tenantfilter -cmdlet 'Get-AdminAuditLogConfig').UnifiedAuditLogIngestionEnabled
$7dayslog = if ($auditLog -eq $false) {
$ExtractResult = 'AuditLog is disabled. Cannot perform full analysis'
} else {
Expand Down Expand Up @@ -40,10 +40,10 @@ try {
Write-Host "Retrieved $($logsTenant.count) logs" -ForegroundColor Yellow
$logsTenant
} while ($LogsTenant.count % 5000 -eq 0 -and $LogsTenant.count -ne 0)
$ExtractResult = 'Succesfully extracted logs from auditlog'
$ExtractResult = 'Successfully extracted logs from auditlog'
}
Try {
$URI = "https://graph.microsoft.com/beta/auditLogs/signIns?`$filter=(userId eq '$SuspectUser')&`$top=1&`$orderby=createdDateTime desc"
$URI = "https://graph.microsoft.com/beta/auditLogs/signIns?`$filter=(userId eq '$SuspectUser')&`$top=1&`$orderby=createdDateTime desc"
$LastSignIn = New-GraphGetRequest -uri $URI -tenantid $TenantFilter -noPagination $true -verbose | Select-Object @{ Name = 'CreatedDateTime'; Expression = { $(($_.createdDateTime | Out-String) -replace '\r\n') } },
id,
@{ Name = 'AppDisplayName'; Expression = { $_.resourceDisplayName } },
Expand Down
13 changes: 7 additions & 6 deletions Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ function Add-CIPPApplicationPermission {
$Tenantfilter
)
if ($ApplicationId -eq $ENV:ApplicationID -and $Tenantfilter -eq $env:TenantID) {
return @('Cannot modify application permissions for CIPP-SAM on partner tenant')
#return @('Cannot modify application permissions for CIPP-SAM on partner tenant')
$RequiredResourceAccess = 'CIPPDefaults'
}
Set-Location (Get-Item $PSScriptRoot).FullName
if ($RequiredResourceAccess -eq 'CIPPDefaults') {
$RequiredResourceAccess = (Get-Content '.\SAMManifest.json' | ConvertFrom-Json).requiredResourceAccess
}
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter -NoAuthCheck $true
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId
if (!$ourSVCPrincipal) {
#Our Service Principal isn't available yet. We do a sleep and reexecute after 3 seconds.
Start-Sleep -Seconds 5
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter -NoAuthCheck $true
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId
}

$Results = [System.Collections.ArrayList]@()

$CurrentRoles = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignments" -tenantid $Tenantfilter -skipTokenCache $true
$CurrentRoles = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignments" -tenantid $Tenantfilter -skipTokenCache $true -NoAuthCheck $true

$Grants = foreach ($App in $RequiredResourceAccess) {
$svcPrincipalId = $ServicePrincipalList | Where-Object -Property AppId -EQ $App.resourceAppId
Expand All @@ -40,12 +41,12 @@ function Add-CIPPApplicationPermission {
$counter = 0
foreach ($Grant in $Grants) {
try {
$SettingsRequest = New-GraphPOSTRequest -body ($Grant | ConvertTo-Json) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST
$SettingsRequest = New-GraphPOSTRequest -body ($Grant | ConvertTo-Json) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST -NoAuthCheck $true
$counter++
} catch {
$Results.add("Failed to grant $($Grant.appRoleId) to $($Grant.resourceId): $($_.Exception.Message)") | Out-Null
}
}
"Added $counter Application permissions to $($ourSVCPrincipal.displayName)"
return $Results
}
}
140 changes: 112 additions & 28 deletions Modules/CIPPCore/Public/Add-CIPPAzDataTableEntity.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,138 @@ function Add-CIPPAzDataTableEntity {
[switch]$Force,
[switch]$CreateTableIfNotExists
)


$MaxRowSize = 500000 - 100 # Maximum size of an entity
$MaxSize = 30kb # Maximum size of a property value

foreach ($SingleEnt in $Entity) {
try {
Add-AzDataTableEntity -context $Context -force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt -ErrorAction Stop
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt -ErrorAction Stop
} catch [System.Exception] {
if ($_.Exception.ErrorCode -eq 'PropertyValueTooLarge' -or $_.Exception.ErrorCode -eq 'EntityTooLarge') {
if ($_.Exception.ErrorCode -eq 'PropertyValueTooLarge' -or $_.Exception.ErrorCode -eq 'EntityTooLarge' -or $_.Exception.ErrorCode -eq 'RequestBodyTooLarge') {
try {
$MaxSize = 30kb
$largePropertyName = $null
$largePropertyNames = [System.Collections.ArrayList]::new()
$entitySize = 0
foreach ($key in $SingleEnt.Keys) {
if ($SingleEnt[$key].Length -gt $MaxSize) {
$largePropertyName = $key
break
$propertySize = [System.Text.Encoding]::UTF8.GetByteCount($SingleEnt[$key].ToString())
$entitySize = $entitySize + $propertySize
if ($propertySize -gt $MaxSize) {
$largePropertyNames.Add($key)
}

}

if ($largePropertyName) {
$dataString = $SingleEnt[$largePropertyName]
$splitCount = [math]::Ceiling($dataString.Length / $MaxSize)
$splitData = 0..($splitCount - 1) | ForEach-Object {
$start = $_ * $MaxSize
$dataString.Substring($start, [Math]::Min($MaxSize, $dataString.Length - $start))
}
if ($largePropertyNames.Count -gt 0) {
$splitInfoList = [System.Collections.ArrayList]@()
foreach ($largePropertyName in $largePropertyNames) {
$dataString = $SingleEnt[$largePropertyName]
$splitCount = [math]::Ceiling($dataString.Length / $MaxSize)
$splitData = [System.Collections.ArrayList]@()
for ($i = 0; $i -lt $splitCount; $i++) {
$start = $i * $MaxSize
$splitData.Add($dataString.Substring($start, [Math]::Min($MaxSize, $dataString.Length - $start))) > $null
}

$splitPropertyNames = [System.Collections.ArrayList]@()
for ($i = 0; $i -lt $splitData.Count; $i++) {
$splitPropertyNames.Add("${largePropertyName}_Part$i") > $null
}

$splitPropertyNames = 1..$splitData.Count | ForEach-Object {
"${largePropertyName}_Part$_"
$splitInfo = @{
OriginalHeader = $largePropertyName
SplitHeaders = $splitPropertyNames
}
$splitInfoList.Add($splitInfo) > $null
$SingleEnt.Remove($largePropertyName)

for ($i = 0; $i -lt $splitData.Count; $i++) {
$SingleEnt[$splitPropertyNames[$i]] = $splitData[$i]
}
}

$splitInfo = @{
OriginalHeader = $largePropertyName
SplitHeaders = $splitPropertyNames
$SingleEnt['SplitOverProps'] = ($splitInfoList | ConvertTo-Json -Compress).ToString()
}

# Check if the entity is still too large
$entitySize = [System.Text.Encoding]::UTF8.GetByteCount($($SingleEnt | ConvertTo-Json))
if ($entitySize -gt $MaxRowSize) {
$rows = [System.Collections.ArrayList]@()
$originalPartitionKey = $SingleEnt.PartitionKey
$originalRowKey = $SingleEnt.RowKey
$entityIndex = 0

while ($entitySize -gt $MaxRowSize) {
Write-Information "Entity size is $entitySize. Splitting entity into multiple parts."
$newEntity = @{}
$newEntity['PartitionKey'] = $originalPartitionKey
if ($entityIndex -eq 0) {
$newEntity['RowKey'] = $originalRowKey
} else {
$newEntity['RowKey'] = "$($originalRowKey)-part$entityIndex"
}
$newEntity['OriginalEntityId'] = $originalRowKey
$newEntity['PartIndex'] = $entityIndex
$entityIndex++

$propertiesToRemove = [System.Collections.ArrayList]@()
foreach ($key in $SingleEnt.Keys) {
$newEntitySize = [System.Text.Encoding]::UTF8.GetByteCount($($newEntity | ConvertTo-Json))
if ($newEntitySize -lt $MaxRowSize) {
$propertySize = [System.Text.Encoding]::UTF8.GetByteCount($SingleEnt[$key].ToString())
if ($propertySize -gt $MaxRowSize) {
$dataString = $SingleEnt[$key]
$splitCount = [math]::Ceiling($dataString.Length / $MaxSize)
$splitData = [System.Collections.ArrayList]@()
for ($i = 0; $i -lt $splitCount; $i++) {
$start = $i * $MaxSize
$splitData.Add($dataString.Substring($start, [Math]::Min($MaxSize, $dataString.Length - $start))) > $null
}

$splitPropertyNames = [System.Collections.ArrayList]@()
for ($i = 0; $i -lt $splitData.Count; $i++) {
$splitPropertyNames.Add("${key}_Part$i") > $null
}

for ($i = 0; $i -lt $splitData.Count; $i++) {
$newEntity[$splitPropertyNames[$i]] = $splitData[$i]
}
} else {
$newEntity[$key] = $SingleEnt[$key]
}
$propertiesToRemove.Add($key) > $null
}
}

foreach ($prop in $propertiesToRemove) {
$SingleEnt.Remove($prop)
}

$rows.Add($newEntity) > $null
$entitySize = [System.Text.Encoding]::UTF8.GetByteCount($($SingleEnt | ConvertTo-Json))
}
$SingleEnt['SplitOverProps'] = ($splitInfo | ConvertTo-Json).ToString()
$SingleEnt.Remove($largePropertyName)

for ($i = 0; $i -lt $splitData.Count; $i++) {
$SingleEnt[$splitPropertyNames[$i]] = $splitData[$i]
if ($SingleEnt.Count -gt 0) {
$SingleEnt['RowKey'] = "$($originalRowKey)-part$entityIndex"
$SingleEnt['OriginalEntityId'] = $originalRowKey
$SingleEnt['PartIndex'] = $entityIndex
$SingleEnt['PartitionKey'] = $originalPartitionKey

$rows.Add($SingleEnt) > $null
}

Add-AzDataTableEntity -context $Context -force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt
foreach ($row in $rows) {
Write-Information "current entity is $($row.RowKey) with $($row.PartitionKey). Our size is $([System.Text.Encoding]::UTF8.GetByteCount($($row | ConvertTo-Json)))"
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $row
}
} else {
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt
}

} catch {
throw "Error processing entity: $($_.Exception.Message)."
throw "Error processing entity: $($_.Exception.Message) Linenumner: $($_.InvocationInfo.ScriptLineNumber)"
}
} else {
Write-Host "THE ERROR IS $($_.Exception.ErrorCode)"

Write-Information "THE ERROR IS $($_.Exception.ErrorCode). The size of the entity is $entitySize."
throw $_
}
}
Expand Down
Loading
Loading