diff --git a/src/Commands/Budgets/BudgetsCommand.cs b/src/Commands/Budgets/BudgetsCommand.cs index 92c7caa..b10f023 100644 --- a/src/Commands/Budgets/BudgetsCommand.cs +++ b/src/Commands/Budgets/BudgetsCommand.cs @@ -37,7 +37,7 @@ public override async Task ExecuteAsync(CommandContext context, BudgetsSett // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/CostByResource/CostByResourceCommand.cs b/src/Commands/CostByResource/CostByResourceCommand.cs index 4867d5b..228c706 100644 --- a/src/Commands/CostByResource/CostByResourceCommand.cs +++ b/src/Commands/CostByResource/CostByResourceCommand.cs @@ -62,7 +62,7 @@ public override async Task ExecuteAsync(CommandContext context, CostByResou // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/CostByTag/CostByTagCommand.cs b/src/Commands/CostByTag/CostByTagCommand.cs index e0b264c..84c442d 100644 --- a/src/Commands/CostByTag/CostByTagCommand.cs +++ b/src/Commands/CostByTag/CostByTagCommand.cs @@ -61,7 +61,7 @@ public override async Task ExecuteAsync(CommandContext context, CostByTagSe // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/DailyCost/DailyCost.cs b/src/Commands/DailyCost/DailyCost.cs index 567fe15..1b2717f 100644 --- a/src/Commands/DailyCost/DailyCost.cs +++ b/src/Commands/DailyCost/DailyCost.cs @@ -63,7 +63,7 @@ public override async Task ExecuteAsync(CommandContext context, DailyCostSe // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/DetectAnomaly/DetectAnomaly.cs b/src/Commands/DetectAnomaly/DetectAnomaly.cs index 583276f..bdc206c 100644 --- a/src/Commands/DetectAnomaly/DetectAnomaly.cs +++ b/src/Commands/DetectAnomaly/DetectAnomaly.cs @@ -60,7 +60,7 @@ public override async Task ExecuteAsync(CommandContext context, DetectAnoma // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/WhatIf/DevTestWhatIfCommand.cs b/src/Commands/WhatIf/DevTestWhatIfCommand.cs index af7f372..9121e60 100644 --- a/src/Commands/WhatIf/DevTestWhatIfCommand.cs +++ b/src/Commands/WhatIf/DevTestWhatIfCommand.cs @@ -38,7 +38,7 @@ public override async Task ExecuteAsync(CommandContext context, WhatIfSetti // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try diff --git a/src/Commands/WhatIf/RegionWhatIfCommand.cs b/src/Commands/WhatIf/RegionWhatIfCommand.cs index 1e71942..1d3ffe9 100644 --- a/src/Commands/WhatIf/RegionWhatIfCommand.cs +++ b/src/Commands/WhatIf/RegionWhatIfCommand.cs @@ -37,7 +37,7 @@ public override async Task ExecuteAsync(CommandContext context, WhatIfSetti // Get the subscription ID from the settings var subscriptionId = settings.Subscription; - if (subscriptionId.GetValueOrDefault() == Guid.Empty) + if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased)) { // Get the subscription ID from the Azure CLI try