Skip to content

Commit

Permalink
Make sure to check if we need to actually fetch the subscription id.
Browse files Browse the repository at this point in the history
  • Loading branch information
mivano committed Mar 16, 2024
1 parent 6055aff commit 2d54e08
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Commands/Budgets/BudgetsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CostByResource/CostByResourceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CostByTag/CostByTagCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DailyCost/DailyCost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DetectAnomaly/DetectAnomaly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/WhatIf/DevTestWhatIfCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override async Task<int> 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
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/WhatIf/RegionWhatIfCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override async Task<int> 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
Expand Down

0 comments on commit 2d54e08

Please sign in to comment.