File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Modules/CIPPCore/Public/TenantGroups Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -103,14 +103,18 @@ function Update-CIPPDynamicTenantGroups {
103103 $LicenseInfo = $SkuHashtable [$_.customerId ]
104104 } else {
105105 Write-Information " Fetching licenses for tenant $ ( $_.defaultDomainName ) "
106- $LicenseInfo = New-GraphGetRequest - uri ' https://graph.microsoft.com/v1.0/subscribedSkus' - TenantId $_.defaultDomainName
107- # Cache the result
108- $CacheEntity = @ {
109- PartitionKey = ' sku'
110- RowKey = [string ]$_.customerId
111- JSON = [string ]($LicenseInfo | ConvertTo-Json - Depth 5 - Compress)
106+ try {
107+ $LicenseInfo = New-GraphGetRequest - uri ' https://graph.microsoft.com/v1.0/subscribedSkus' - TenantId $_.defaultDomainName
108+ # Cache the result
109+ $CacheEntity = @ {
110+ PartitionKey = ' sku'
111+ RowKey = [string ]$_.customerId
112+ JSON = [string ]($LicenseInfo | ConvertTo-Json - Depth 5 - Compress)
113+ }
114+ Add-CIPPAzDataTableEntity @LicenseCacheTable - Entity $CacheEntity - Force
115+ } catch {
116+ Write-LogMessage - API ' TenantGroups' - message ' Error getting licenses' - Tenant $_.defaultDomainName - sev Warning - LogData (Get-CippExeception - Exception $_ )
112117 }
113- Add-CIPPAzDataTableEntity @LicenseCacheTable - Entity $CacheEntity - Force
114118 }
115119 }
116120 $SKUId = $LicenseInfo.SKUId ?? @ ()
You can’t perform that action at this time.
0 commit comments