diff --git a/pwsh/module/build/AzAPICall.zip b/pwsh/module/build/AzAPICall.zip index 798bafb..6c0abd7 100644 Binary files a/pwsh/module/build/AzAPICall.zip and b/pwsh/module/build/AzAPICall.zip differ diff --git a/pwsh/module/build/AzAPICall/AzAPICall.psd1 b/pwsh/module/build/AzAPICall/AzAPICall.psd1 index 78d2111..b355f3f 100644 --- a/pwsh/module/build/AzAPICall/AzAPICall.psd1 +++ b/pwsh/module/build/AzAPICall/AzAPICall.psd1 @@ -12,7 +12,7 @@ RootModule = 'AzAPICall.psm1' # Version number of this module. - ModuleVersion = '1.2.2' + ModuleVersion = '1.2.3' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/pwsh/module/build/AzAPICall/functions/AzAPICallFunctions.ps1 b/pwsh/module/build/AzAPICall/functions/AzAPICallFunctions.ps1 index 3f761df..5ad2980 100644 --- a/pwsh/module/build/AzAPICall/functions/AzAPICallFunctions.ps1 +++ b/pwsh/module/build/AzAPICall/functions/AzAPICallFunctions.ps1 @@ -1006,6 +1006,7 @@ function AzAPICallErrorHandler { $getARMCostManagement -and ( $catchResult.error.code -eq 404 -or $catchResult.error.code -eq 'AccountCostDisabled' -or + $catchResult.error.code -eq 'SubscriptionCostDisabled' -or $catchResult.error.message -like '*does not have any valid subscriptions*' -or $catchResult.error.code -eq 'Unauthorized' -or ($catchResult.error.code -eq 'NotFound' -and $catchResult.error.message -like '*have valid WebDirect/AIRS offer type*') -or @@ -1034,6 +1035,15 @@ function AzAPICallErrorHandler { return $response } + if ($catchResult.error.code -eq 'SubscriptionCostDisabled') { + Logging -preventWriteOutput $true -logMessage "$defaultErrorInfo - (plain : $catchResult) - AzAPICall: seems Access to cost data has been disabled for this Subscription - skipping CostManagement for this Subscription - return 'SubscriptionCostDisabled'" + $response = @{ + action = 'return' #break or return or returnCollection + returnVar = 'SubscriptionCostDisabled' + } + return $response + } + if ($catchResult.error.message -like '*does not have any valid subscriptions*') { Logging -preventWriteOutput $true -logMessage "$defaultErrorInfo - (plain : $catchResult) - AzAPICall: seems there are no valid Subscriptions present - skipping CostManagement on MG level - return 'NoValidSubscriptions'" $response = @{ @@ -1713,7 +1723,7 @@ function getAzAPICallFunctions { function getAzAPICallRuleSet { return $function:AzAPICallErrorHandler.ToString() } -function getAzAPICallVersion { return '1.2.2' } +function getAzAPICallVersion { return '1.2.3' } function getJWTDetails { <# diff --git a/pwsh/module/dev/AzAPICall/AzAPICall.psd1 b/pwsh/module/dev/AzAPICall/AzAPICall.psd1 index 78d2111..b355f3f 100644 --- a/pwsh/module/dev/AzAPICall/AzAPICall.psd1 +++ b/pwsh/module/dev/AzAPICall/AzAPICall.psd1 @@ -12,7 +12,7 @@ RootModule = 'AzAPICall.psm1' # Version number of this module. - ModuleVersion = '1.2.2' + ModuleVersion = '1.2.3' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/pwsh/module/dev/AzAPICall/functions/AzAPICallRuleSet.ps1 b/pwsh/module/dev/AzAPICall/functions/AzAPICallRuleSet.ps1 index fe792d9..643abb8 100644 --- a/pwsh/module/dev/AzAPICall/functions/AzAPICallRuleSet.ps1 +++ b/pwsh/module/dev/AzAPICall/functions/AzAPICallRuleSet.ps1 @@ -300,6 +300,7 @@ function AzAPICallErrorHandler { $getARMCostManagement -and ( $catchResult.error.code -eq 404 -or $catchResult.error.code -eq 'AccountCostDisabled' -or + $catchResult.error.code -eq 'SubscriptionCostDisabled' -or $catchResult.error.message -like '*does not have any valid subscriptions*' -or $catchResult.error.code -eq 'Unauthorized' -or ($catchResult.error.code -eq 'NotFound' -and $catchResult.error.message -like '*have valid WebDirect/AIRS offer type*') -or @@ -328,6 +329,15 @@ function AzAPICallErrorHandler { return $response } + if ($catchResult.error.code -eq 'SubscriptionCostDisabled') { + Logging -preventWriteOutput $true -logMessage "$defaultErrorInfo - (plain : $catchResult) - AzAPICall: seems Access to cost data has been disabled for this Subscription - skipping CostManagement for this Subscription - return 'SubscriptionCostDisabled'" + $response = @{ + action = 'return' #break or return or returnCollection + returnVar = 'SubscriptionCostDisabled' + } + return $response + } + if ($catchResult.error.message -like '*does not have any valid subscriptions*') { Logging -preventWriteOutput $true -logMessage "$defaultErrorInfo - (plain : $catchResult) - AzAPICall: seems there are no valid Subscriptions present - skipping CostManagement on MG level - return 'NoValidSubscriptions'" $response = @{ diff --git a/pwsh/module/dev/AzAPICall/functions/getAzAPICallVersion.ps1 b/pwsh/module/dev/AzAPICall/functions/getAzAPICallVersion.ps1 index cf6e781..3a00d83 100644 --- a/pwsh/module/dev/AzAPICall/functions/getAzAPICallVersion.ps1 +++ b/pwsh/module/dev/AzAPICall/functions/getAzAPICallVersion.ps1 @@ -1 +1 @@ -function getAzAPICallVersion { return '1.2.2' } +function getAzAPICallVersion { return '1.2.3' }