Skip to content

Commit c1b9063

Browse files
authored
Merge branch 'dev' into chore-more-endpoints-again-again
2 parents 9b5ee91 + 0e1e210 commit c1b9063

File tree

437 files changed

+77684
-42998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

437 files changed

+77684
-42998
lines changed

.github/workflows/dev_cipppwrro.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
{
2-
"recommendations": [
3-
"editorconfig.editorconfig"
4-
]
5-
}
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"streetsidesoftware.code-spell-checker"
5+
]
6+
}

AddChocoApp/IntunePackage/Install.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ param (
1919

2020
try {
2121
if ($Trace) { Start-Transcript -Path (Join-Path $env:windir "\temp\choco-$Packagename-trace.log") }
22-
$chocoPath = "$($ENV:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
22+
$chocoPath = "$($env:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
2323

2424
if ($InstallChoco) {
2525
if (-not (Test-Path $chocoPath)) {
2626
try {
2727
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
28-
$chocoPath = "$($ENV:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
28+
$chocoPath = "$($env:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
2929
}
3030
catch {
3131
Write-Host "InstallChoco Error: $($_.Exception.Message)"
@@ -45,7 +45,7 @@ try {
4545
& "$chocoPath" install $Packagename -y $CustomRepoString
4646
}
4747
Write-Host 'Completed.'
48-
}
48+
}
4949
catch {
5050
Write-Host "Install/upgrade error: $($_.Exception.Message)"
5151
}

AddChocoApp/IntunePackage/Uninstall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ param (
44
[string]
55
$Packagename
66
)
7-
$chocoPath = "$($ENV:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
7+
$chocoPath = "$($env:SystemDrive)\ProgramData\chocolatey\bin\choco.exe"
88
& $Chocopath uninstall $Packagename -y
99

ConversionTable.csv

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3433,6 +3433,44 @@ Microsoft Copilot for Microsoft 365,Microsoft_365_Copilot,639dec6b-bb19-468b-871
34333433
Microsoft Copilot for Microsoft 365,Microsoft_365_Copilot,639dec6b-bb19-468b-871c-c5c441c4b0cb,M365_COPILOT_TEAMS,b95945de-b3bd-46db-8437-f2beb6ea2347,Microsoft 365 Copilot in Microsoft Teams
34343434
Microsoft Copilot for Microsoft 365,Microsoft_365_Copilot,639dec6b-bb19-468b-871c-c5c441c4b0cb,M365_COPILOT_APPS,a62f8878-de10-42f3-b68f-6149a25ceb97,Microsoft 365 Copilot in Productivity Apps
34353435
Microsoft Copilot for Microsoft 365,Microsoft_365_Copilot,639dec6b-bb19-468b-871c-c5c441c4b0cb,M365_COPILOT_CONNECTORS,89f1c4c8-0878-40f7-804d-869c9128ab5d,Power Platform Connectors in Microsoft 365 Copilot
3436+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,COPILOT_STUDIO_IN_COPILOT_FOR_M365,fe6c28b3-d468-44ea-bbd0-a10a5167435c,Copilot Studio in Copilot for M365
3437+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,GRAPH_CONNECTORS_COPILOT,82d30987-df9b-4486-b146-198b21d164c7,Graph Connectors in Microsoft 365 Copilot
3438+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_INTELLIGENT_SEARCH,931e4a88-a67f-48b5-814f-16a5f1e6028d,Intelligent Search
3439+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_SHAREPOINT,0aedf20c-091d-420b-aadf-30c042609612,Microsoft 365 Copilot for SharePoint
3440+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_TEAMS,b95945de-b3bd-46db-8437-f2beb6ea2347,Microsoft 365 Copilot in Microsoft Teams
3441+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_APPS,a62f8878-de10-42f3-b68f-6149a25ceb97,Microsoft 365 Copilot in Productivity Apps
3442+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,Microsoft_Copilot_for_Sales,a2194428-ead1-4fc1-bb81-ab8675125f42,Microsoft Copilot for Sales
3443+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,Microsoft_Copilot_for_Sales_PowerAutomate,0c1c2af2-6c51-43c7-9c55-fa487ac147ff,Microsoft Copilot for Sales with Power Automate
3444+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_BUSINESS_CHAT,3f30311c-6b1e-48a4-ab79-725b469da960,Microsoft Copilot with Graph-grounded chat
3445+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,WORKPLACE_ANALYTICS_INSIGHTS_USER,b622badb-1b45-48d5-920f-4b27a2c0996c,Microsoft Viva Insights
3446+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,WORKPLACE_ANALYTICS_INSIGHTS_BACKEND,ff7b261f-d98b-415b-827c-42a3fdf015af,Microsoft Viva Insights Backend
3447+
Microsoft 365 Copilot for Sales,Microsoft_Copilot_for_Sales,15f2e9fc-b782-4f73-bf51-81d8b7fff6f4,M365_COPILOT_CONNECTORS,89f1c4c8-0878-40f7-804d-869c9128ab5d,Power Platform Connectors in Microsoft 365 Copilot
3448+
Microsoft Copilot Studio,Power_Virtual_Agents,75564b9c-51e8-431c-b8fe-d472d5a545c8,CDS_VIRTUAL_AGENT_BASE_MESSAGES,5dd1819f-0de7-487f-985b-c450a4c9cc1d,Dataverse for Microsoft Copilot Studio
3449+
Microsoft Copilot Studio,Power_Virtual_Agents,75564b9c-51e8-431c-b8fe-d472d5a545c8,VIRTUAL_AGENT_BASE_MESSAGES,7b0640f1-63cc-4f83-b8c6-0a4d78b8b988,Microsoft Copilot Studio – Messages
3450+
Microsoft Copilot Studio,Power_Virtual_Agents,75564b9c-51e8-431c-b8fe-d472d5a545c8,FLOW_VIRTUAL_AGENT_BASE_MESSAGES,4b9ec373-ed29-4192-8a47-c9ab9048b079,Power Automate for Microsoft Copilot Studio
3451+
Microsoft Copilot Studio for GCC,Power_Virtual_Agents_for_GCC_GCC,d7974fa0-ddd7-4899-9589-1ea04273aa26,CDS_VIRTUAL_AGENT_BASE_MESSAGES,5dd1819f-0de7-487f-985b-c450a4c9cc1d,Dataverse for Microsoft Copilot Studio
3452+
Microsoft Copilot Studio for GCC,Power_Virtual_Agents_for_GCC_GCC,d7974fa0-ddd7-4899-9589-1ea04273aa26,VIRTUAL_AGENT_BASE_MESSAGES,7b0640f1-63cc-4f83-b8c6-0a4d78b8b988,Microsoft Copilot Studio – Messages
3453+
Microsoft Copilot Studio for GCC,Power_Virtual_Agents_for_GCC_GCC,d7974fa0-ddd7-4899-9589-1ea04273aa26,FLOW_VIRTUAL_AGENT_BASE_MESSAGES,4b9ec373-ed29-4192-8a47-c9ab9048b079,Power Automate for Microsoft Copilot Studio
3454+
Microsoft Copilot Studio_USGOV_GCCHIGH,Power_Virtual_Agents_USGOV_GCCHIGH,84ed7c30-3738-43a0-aa03-cf6c577d8dbb,CDS_VIRTUAL_AGENT_BASE_MESSAGES,5dd1819f-0de7-487f-985b-c450a4c9cc1d,CDS_VIRTUAL_AGENT_BASE_MESSAGES
3455+
Microsoft Copilot Studio_USGOV_GCCHIGH,Power_Virtual_Agents_USGOV_GCCHIGH,84ed7c30-3738-43a0-aa03-cf6c577d8dbb,VIRTUAL_AGENT_BASE_MESSAGES,7b0640f1-63cc-4f83-b8c6-0a4d78b8b988,VIRTUAL_AGENT_BASE_MESSAGES
3456+
Microsoft Copilot Studio_USGOV_GCCHIGH,Power_Virtual_Agents_USGOV_GCCHIGH,84ed7c30-3738-43a0-aa03-cf6c577d8dbb,FLOW_VIRTUAL_AGENT_BASE_MESSAGES,4b9ec373-ed29-4192-8a47-c9ab9048b079,FLOW_VIRTUAL_AGENT_BASE_MESSAGES
3457+
Microsoft Copilot Studio User License,VIRTUAL_AGENT_USL,4b74a65c-8b4a-4fc8-9f6b-5177ed11ddfa,CDS_VIRTUAL_AGENT_USL,cb867b3c-7f38-4d0d-99ce-e29cd69812c8,Common Data Service
3458+
Microsoft Copilot Studio User License,VIRTUAL_AGENT_USL,4b74a65c-8b4a-4fc8-9f6b-5177ed11ddfa,FLOW_VIRTUAL_AGENT_USL,82f141c9-2e87-4f43-8cb2-12d2701dc6b3,Power Automate for Virtual Agent
3459+
Microsoft Copilot Studio User License,VIRTUAL_AGENT_USL,4b74a65c-8b4a-4fc8-9f6b-5177ed11ddfa,VIRTUAL_AGENT_USL,1263586c-59a4-4ad0-85e1-d50bc7149501,Virtual Agent
3460+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,CDS_Virtual_Agent_Usl_Gov,bcc0702e-ba97-48d9-ae04-fa8689c53bba,Dataverse for Virtual Agent USL for GCC
3461+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,Virtual_Agent_Usl_Gov,00b6f978-853b-4041-9de0-a233d18669aa,Virtual Agent for GCC
3462+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,CDS_Virtual_Agent_Usl_GCC,95df1203-fee7-4726-b7e1-8037a8e899eb,Dataverse for Virtual Agent USL for GCC
3463+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,Flow_Virtual_Agent_Usl_Gov,0b939472-1861-45f1-ab6d-208f359c05cd,Flow for Virtual Agent for GCC
3464+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,FLOW_Virtual_Agent_Base_Gov,f9f6db16-ace6-4838-b11c-892ee75e810a,Power Automate for Virtual Agent for GCC
3465+
Microsoft Copilot Studio User License for GCC,VIRTUAL_AGENT_USL_GCC,f1de227b-f1bd-4959-bd80-b80547095e6d,Power_Virtual_Agent_Usl_GCC,0bdd5466-65c3-470a-9fa6-f679b48286b0,Power Virtual Agent USL for GCC
3466+
Microsoft Copilot Studio User License for GCC High_USGOV_GCCHIGH,VIRTUAL_AGENT_USL_AR_USGOV_GCCHIGH,470845c0-6884-47e1-89d0-9d6244a77b44,Virtual_Agent_Usl_Gov_High,7ffee552-ebe8-4725-8678-5c1775c05847,Virtual Agent for GCC High
3467+
Microsoft Copilot Studio User License for GCC High_USGOV_GCCHIGH,VIRTUAL_AGENT_USL_AR_USGOV_GCCHIGH,470845c0-6884-47e1-89d0-9d6244a77b44,CDS_VIRTUAL_AGENT_USL,cb867b3c-7f38-4d0d-99ce-e29cd69812c8,Common Data Service
3468+
Microsoft Copilot Studio User License for GCC High_USGOV_GCCHIGH,VIRTUAL_AGENT_USL_AR_USGOV_GCCHIGH,470845c0-6884-47e1-89d0-9d6244a77b44,FLOW_Virtual_Agent_Base_Gov_High,225e52e5-7bbf-4793-8fb1-4307a7a1ae8e,Flow for Virtual Agent for GCC High
3469+
Microsoft Copilot Studio User License for GCC High_USGOV_GCCHIGH,VIRTUAL_AGENT_USL_AR_USGOV_GCCHIGH,470845c0-6884-47e1-89d0-9d6244a77b44,Flow_Virtual_Agent_Usl_Gov_High,aaae1744-dc7a-4811-9dd0-2bf926ff9d80,Flow for Virtual Agent for GCC High
3470+
Microsoft Copilot Studio User License for GCC High_USGOV_GCCHIGH,VIRTUAL_AGENT_USL_AR_USGOV_GCCHIGH,470845c0-6884-47e1-89d0-9d6244a77b44,Power_Virtual_Agent_Usl_GCC_High,3fbe8cdf-c735-44bf-bbfa-646724af4bb4,Power Virtual Agent USL for GCC High
3471+
Microsoft Copilot Studio Viral Trial,CCIBOTS_PRIVPREV_VIRAL,606b54a9-78d8-4298-ad8b-df6ef4481c80,DYN365_CDS_CCI_BOTS,cf7034ed-348f-42eb-8bbd-dddeea43ee81,DYN365_CDS_CCI_BOTS
3472+
Microsoft Copilot Studio Viral Trial,CCIBOTS_PRIVPREV_VIRAL,606b54a9-78d8-4298-ad8b-df6ef4481c80,CCIBOTS_PRIVPREV_VIRAL,ce312d15-8fdf-44c0-9974-a25a177125ee,CCIBOTS_PRIVPREV_VIRAL
3473+
Microsoft Copilot Studio Viral Trial,CCIBOTS_PRIVPREV_VIRAL,606b54a9-78d8-4298-ad8b-df6ef4481c80,FLOW_CCI_BOTS,5d798708-6473-48ad-9776-3acc301c40af,FLOW_CCI_BOTS
34363474
Microsoft Cloud App Security,ADALLOM_STANDALONE,df845ce7-05f9-4894-b5f2-11bbfbcfd2b6,EXCHANGE_S_FOUNDATION,113feb6c-3fe4-4440-bddc-54d774bf0318,Exchange Foundation
34373475
Microsoft Cloud App Security,ADALLOM_STANDALONE,df845ce7-05f9-4894-b5f2-11bbfbcfd2b6,ADALLOM_S_STANDALONE,2e2ddb96-6af9-4b1d-a3f0-d6ecfd22edb2,Microsoft Cloud App Security
34383476
Microsoft Cloud for Sustainability vTrial,Microsoft_Cloud_for_Sustainability_vTrial,556640c0-53ea-4773-907d-29c55332983f,MCS_BizApps_Cloud_for_Sustainability_vTrial,c1c902e3-a956-4273-abdb-c92afcd027ef,MCS - BizApps_Cloud for Sustainability_vTrial

Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Add-CIPPApplicationPermission {
55
$ApplicationId,
66
$Tenantfilter
77
)
8-
if ($ApplicationId -eq $ENV:ApplicationID -and $Tenantfilter -eq $env:TenantID) {
8+
if ($ApplicationId -eq $env:ApplicationID -and $Tenantfilter -eq $env:TenantID) {
99
#return @('Cannot modify application permissions for CIPP-SAM on partner tenant')
1010
$RequiredResourceAccess = 'CIPPDefaults'
1111
}

Modules/CIPPCore/Public/Add-CIPPAzDataTableEntity.ps1

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,54 @@
11
function Add-CIPPAzDataTableEntity {
2-
[CmdletBinding()]
2+
[CmdletBinding(DefaultParameterSetName = 'OperationType')]
33
param(
44
$Context,
55
$Entity,
6+
[switch]$CreateTableIfNotExists,
7+
8+
[Parameter(ParameterSetName = 'Force')]
69
[switch]$Force,
7-
[switch]$CreateTableIfNotExists
10+
11+
[Parameter(ParameterSetName = 'OperationType')]
12+
[ValidateSet('Add', 'UpsertMerge', 'UpsertReplace')]
13+
[string]$OperationType = 'Add'
814
)
915

10-
$MaxRowSize = 500000 - 100 # Maximum size of an entity
11-
$MaxSize = 30kb # Maximum size of a property value
16+
$Parameters = @{
17+
Context = $Context
18+
CreateTableIfNotExists = $CreateTableIfNotExists
19+
}
20+
if ($PSCmdlet.ParameterSetName -eq 'Force') {
21+
$Parameters.Force = $Force
22+
} else {
23+
$Parameters.OperationType = $OperationType
24+
}
25+
26+
$MaxRowSize = 500000 - 100
27+
$MaxSize = 30kb
1228

1329
foreach ($SingleEnt in @($Entity)) {
1430
try {
1531
if ($null -eq $SingleEnt.PartitionKey -or $null -eq $SingleEnt.RowKey) {
1632
throw 'PartitionKey or RowKey is null'
1733
}
18-
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt -ErrorAction Stop
34+
35+
Add-AzDataTableEntity @Parameters -Entity $SingleEnt -ErrorAction Stop
36+
1937
} catch [System.Exception] {
20-
if ($_.Exception.ErrorCode -eq 'PropertyValueTooLarge' -or $_.Exception.ErrorCode -eq 'EntityTooLarge' -or $_.Exception.ErrorCode -eq 'RequestBodyTooLarge') {
38+
if ($_.Exception.ErrorCode -in @('PropertyValueTooLarge', 'EntityTooLarge', 'RequestBodyTooLarge')) {
2139
try {
2240
Write-Host 'Entity is too large. Splitting entity into multiple parts.'
23-
#Write-Information ($SingleEnt | ConvertTo-Json)
41+
2442
$largePropertyNames = [System.Collections.Generic.List[string]]::new()
2543
$entitySize = 0
2644

27-
# Convert $SingleEnt to hashtable if it is a PSObject
2845
if ($SingleEnt -is [System.Management.Automation.PSCustomObject]) {
2946
$SingleEnt = $SingleEnt | ConvertTo-Json -Depth 100 -Compress | ConvertFrom-Json -AsHashtable
3047
}
3148

3249
foreach ($key in $SingleEnt.Keys) {
3350
$propertySize = [System.Text.Encoding]::UTF8.GetByteCount($SingleEnt[$key].ToString())
34-
$entitySize = $entitySize + $propertySize
51+
$entitySize += $propertySize
3552
if ($propertySize -gt $MaxSize) {
3653
$largePropertyNames.Add($key)
3754
}
@@ -47,7 +64,7 @@ function Add-CIPPAzDataTableEntity {
4764
$start = $i * $MaxSize
4865
$splitData.Add($dataString.Substring($start, [Math]::Min($MaxSize, $dataString.Length - $start))) > $null
4966
}
50-
$splitDataCount = ($splitData | Measure-Object).Count
67+
$splitDataCount = $splitData.Count
5168
$splitPropertyNames = [System.Collections.Generic.List[object]]::new()
5269
for ($i = 0; $i -lt $splitDataCount; $i++) {
5370
$splitPropertyNames.Add("${largePropertyName}_Part$i")
@@ -64,11 +81,9 @@ function Add-CIPPAzDataTableEntity {
6481
$SingleEnt[$splitPropertyNames[$i]] = $splitData[$i]
6582
}
6683
}
67-
6884
$SingleEnt['SplitOverProps'] = ($splitInfoList | ConvertTo-Json -Compress).ToString()
6985
}
7086

71-
# Check if the entity is still too large
7287
$entitySize = [System.Text.Encoding]::UTF8.GetByteCount($($SingleEnt | ConvertTo-Json -Compress))
7388
if ($entitySize -gt $MaxRowSize) {
7489
$rows = [System.Collections.Generic.List[object]]::new()
@@ -80,11 +95,7 @@ function Add-CIPPAzDataTableEntity {
8095
Write-Information "Entity size is $entitySize. Splitting entity into multiple parts."
8196
$newEntity = @{}
8297
$newEntity['PartitionKey'] = $originalPartitionKey
83-
if ($entityIndex -eq 0) {
84-
$newEntity['RowKey'] = $originalRowKey
85-
} else {
86-
$newEntity['RowKey'] = "$($originalRowKey)-part$entityIndex"
87-
}
98+
$newEntity['RowKey'] = if ($entityIndex -eq 0) { $originalRowKey } else { "$($originalRowKey)-part$entityIndex" }
8899
$newEntity['OriginalEntityId'] = $originalRowKey
89100
$newEntity['PartIndex'] = $entityIndex
90101
$entityIndex++
@@ -126,28 +137,41 @@ function Add-CIPPAzDataTableEntity {
126137
$entitySize = [System.Text.Encoding]::UTF8.GetByteCount($($SingleEnt | ConvertTo-Json -Compress))
127138
}
128139

129-
if (($SingleEnt | Measure-Object).Count -gt 0) {
140+
if ($SingleEnt.Count -gt 0) {
130141
$SingleEnt['RowKey'] = "$($originalRowKey)-part$entityIndex"
131142
$SingleEnt['OriginalEntityId'] = $originalRowKey
132143
$SingleEnt['PartIndex'] = $entityIndex
133144
$SingleEnt['PartitionKey'] = $originalPartitionKey
134-
135145
$rows.Add($SingleEnt)
136146
}
137147

138148
foreach ($row in $rows) {
139149
Write-Information "current entity is $($row.RowKey) with $($row.PartitionKey). Our size is $([System.Text.Encoding]::UTF8.GetByteCount($($row | ConvertTo-Json -Compress)))"
140-
$NewRow = [PSCustomObject]$row
141-
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $NewRow
150+
$NewRow = ([PSCustomObject]$row) | Select-Object * -ExcludeProperty Timestamp
151+
Add-AzDataTableEntity @Parameters -Entity $NewRow
142152
}
153+
143154
} else {
144-
$NewEnt = [PSCustomObject]$SingleEnt
145-
Add-AzDataTableEntity -Context $Context -Force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $NewEnt
155+
$NewEnt = ([PSCustomObject]$SingleEnt) | Select-Object * -ExcludeProperty Timestamp
156+
Add-AzDataTableEntity @Parameters -Entity $NewEnt
157+
if ($NewEnt.PSObject.Properties['OriginalEntityId'] -eq $null -and $NewEnt.PSObject.Properties['PartIndex'] -eq $null) {
158+
$partIndex = 1
159+
while ($true) {
160+
$partRowKey = "$($NewEnt.RowKey)-part$partIndex"
161+
try {
162+
Remove-AzDataTableEntity -Context $Context -PartitionKey $NewEnt.PartitionKey -RowKey $partRowKey -ErrorAction Stop
163+
Write-Information "Deleted obsolete part: $partRowKey"
164+
$partIndex++
165+
} catch {
166+
break
167+
}
168+
}
169+
}
146170
}
147171

148172
} catch {
149173
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
150-
Write-Warning ("AzBobbyTables Error")
174+
Write-Warning 'AzBobbyTables Error'
151175
Write-Information ($SingleEnt | ConvertTo-Json)
152176
throw "Error processing entity: $ErrorMessage Linenumber: $($_.InvocationInfo.ScriptLineNumber)"
153177
}

0 commit comments

Comments
 (0)