Skip to content

Commit def839e

Browse files
updates
1 parent 63009e6 commit def839e

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-AddCAPolicy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Function Invoke-AddCAPolicy {
1313
$APIName = $TriggerMetadata.FunctionName
1414
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
1515

16-
$Tenants = ($Request.body | Select-Object Select_*).psobject.properties.value
16+
$Tenants = $Request.body.tenantFilter.value
1717
if ('AllTenants' -in $Tenants) { $Tenants = (Get-Tenants).defaultDomainName }
1818

1919
$results = foreach ($Tenant in $tenants) {

Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Function Invoke-ExecCSPLicense {
2020
# Interact with query parameters or the body of the request.
2121
$TenantFilter = $Request.body.TenantFilter
2222
$Action = $Request.body.Action
23-
2423
try {
2524
if ($Action -eq 'Add') {
2625
$GraphRequest = Set-SherwebSubscription -tenantFilter $TenantFilter -SKU $Request.body.sku -add $Request.body.Add
@@ -31,7 +30,7 @@ Function Invoke-ExecCSPLicense {
3130
}
3231

3332
if ($Action -eq 'NewSub') {
34-
$GraphRequest = Set-SherwebSubscription -tenantFilter $TenantFilter -SKU $Request.body.sku -Quantity $Request.body.Quantity
33+
$GraphRequest = Set-SherwebSubscription -tenantFilter $TenantFilter -SKU $Request.body.sku.value -Quantity $Request.body.Quantity
3534
}
3635
if ($Action -eq 'Cancel') {
3736
$GraphRequest = Remove-SherwebSubscription -tenantFilter $TenantFilter -SubscriptionIds $Request.body.SubscriptionIds
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using namespace System.Net
2+
3+
Function Invoke-ListCSPsku {
4+
<#
5+
.FUNCTIONALITY
6+
Entrypoint
7+
.ROLE
8+
Tenant.Directory.Read
9+
#>
10+
[CmdletBinding()]
11+
param($Request, $TriggerMetadata)
12+
13+
$APIName = $TriggerMetadata.FunctionName
14+
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
15+
16+
$GraphRequest = Get-SherwebCatalog -TenantFilter $Request.Query.TenantFilter
17+
18+
19+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
20+
StatusCode = [HttpStatusCode]::OK
21+
Body = @($GraphRequest)
22+
}) -Clobber
23+
24+
}

Modules/CIPPCore/Public/GraphHelper/Get-NormalizedError.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function Get-NormalizedError {
6464
'*AADSTS53003*' { 'Access has been blocked by Conditional Access policies. Please check the Conditional Access configuration documentation' }
6565
'*AADSTS900023*' { 'This tenant is not available for this operation. Please check the selected tenant and try again.' }
6666
'*AADSTS9002313*' { 'The credentials used to connect to the Graph API are not available, please retry. If this issue persists you may need to execute the SAM wizard.' }
67+
'*One or more platform(s) is/are not configured for the customer. Please configure the platform before trying to purchase a SKU.*' { 'One or more platform(s) is/are not configured for the customer. Please configure the platform before trying to purchase a SKU.' }
6768
Default { $message }
6869

6970
}

Modules/CIPPCore/Public/New-CIPPCATemplate.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,25 @@ function New-CIPPCATemplate {
3131
if ($excludelocations) { $JSON.conditions.locations.excludeLocations = $excludelocations }
3232
if ($JSON.conditions.users.includeUsers) {
3333
$JSON.conditions.users.includeUsers = @($JSON.conditions.users.includeUsers | ForEach-Object {
34+
$originalID = $_
3435
if ($_ -in 'All', 'None', 'GuestOrExternalUsers') { return $_ }
3536
try {
3637
(New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($_)" -tenantid $TenantFilter).displayName
3738
} catch {
38-
return $_
39+
return $originalID
3940
}
4041
})
4142
}
4243

4344
if ($JSON.conditions.users.excludeUsers) {
4445
$JSON.conditions.users.excludeUsers = @($JSON.conditions.users.excludeUsers | ForEach-Object {
4546
if ($_ -in 'All', 'None', 'GuestOrExternalUsers') { return $_ }
47+
$originalID = $_
48+
4649
try {
4750
(New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($_)" -tenantid $TenantFilter).displayName
4851
} catch {
49-
return $_
52+
return $originalID
5053
}
5154
})
5255
}
@@ -58,21 +61,25 @@ function New-CIPPCATemplate {
5861

5962
if ($JSON.conditions.users.includeGroups) {
6063
$JSON.conditions.users.includeGroups = @($JSON.conditions.users.includeGroups | ForEach-Object {
64+
$originalID = $_
6165
if ($_ -in 'All', 'None', 'GuestOrExternalUsers' -or -not (Test-IsGuid $_)) { return $_ }
6266
try {
6367
(New-GraphGetRequest -uri "https://graph.microsoft.com/beta/groups/$($_)" -tenantid $TenantFilter).displayName
6468
} catch {
65-
return $_
69+
return $originalID
6670
}
6771
})
6872
}
6973
if ($JSON.conditions.users.excludeGroups) {
7074
$JSON.conditions.users.excludeGroups = @($JSON.conditions.users.excludeGroups | ForEach-Object {
75+
$originalID = $_
76+
7177
if ($_ -in 'All', 'None', 'GuestOrExternalUsers' -or -not (Test-IsGuid $_)) { return $_ }
7278
try {
7379
(New-GraphGetRequest -uri "https://graph.microsoft.com/beta/groups/$($_)" -tenantid $TenantFilter).displayName
7480
} catch {
75-
return $_
81+
return $originalID
82+
7683
}
7784
})
7885
}

0 commit comments

Comments
 (0)