Skip to content

Commit

Permalink
Remove part of health check that depends on stability of resource man…
Browse files Browse the repository at this point in the history
…ager API.
  • Loading branch information
Ceredron committed Nov 8, 2024
1 parent 69f71aa commit 9b950c6
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/Altinn.Broker.API/Controllers/HealthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ public async Task<ActionResult> HealthCheckAsync()
return BadRequest("Exception thrown while trying to query database");
}

// Verify that resource manager has access to our subscription
var credentials = new DefaultAzureCredential();
var armClient = new ArmClient(credentials);
var subscription = armClient.GetSubscriptionResource(new ResourceIdentifier($"/subscriptions/{_azureResourceManagerOptions.SubscriptionId}"));
var resourceGroupCollection = subscription.GetResourceGroups();
var resourceGroupCount = resourceGroupCollection.Count();
if (resourceGroupCount < 1)
{
return BadRequest($"Resource groups not found under subscription with id: {subscription.Id}. Are the service principal environment variables set?");
}
await resourceGroupCollection.GetAsync(_azureResourceManagerOptions.ApplicationResourceGroupName);

return Ok("Environment properly configured");
}
}

0 comments on commit 9b950c6

Please sign in to comment.