Skip to content

Support provisioning azure resources for dev#8

Merged
davidfowl merged 5 commits into
mainfrom
davidfowl/azure-with-provisioning
Oct 2, 2023
Merged

Support provisioning azure resources for dev#8
davidfowl merged 5 commits into
mainfrom
davidfowl/azure-with-provisioning

Conversation

@davidfowl

Copy link
Copy Markdown
Contributor
  • Use the Azure management SDK to spin up resources for various app model components.
  • Added azure resources that we have components for i.e. ServiceBus, KeyVault and Storage (queues, blobs and tables)
  • If the azure subscription isn't specific in config provisioning will log a warning and skip. This means the app won't change.
  • Also preserved passing connection information to the dev host via configuration also still works (this was preserved)

Most of this logic was reverse engineered from various samples and many bicep files in a playground. This makes playing with azure resources much easier.

PS: There is no tear down of the resources when the app closes.

@karolz-ms I'd like to figure out a way to represent "external resources" in dcp (components that exist but are managed externally).

- Use the Azure management SDK to spin up resources for various app model components.
- Added azure resources that we have components for i.e. ServiceBus, KeyVault and Storage (queues, blobs and tables)
- If the azure subscription isn't specific in config provisoning will log a warning and skip. This means the app won't change.
- Also preserved passing connection information to the dev host via configuration also still works (this was preserved)
Comment thread src/Aspire.Hosting.Azure/AzureProvisioner.cs Outdated
@davidfowl

davidfowl commented Oct 1, 2023

Copy link
Copy Markdown
Contributor Author

How do we get things added to the feed? Azure.ResourceManager.Authorization is missing? Queued a job to mirror this package

@mitchdenny

Copy link
Copy Markdown
Member

More of a general comment about the API approach here. I wonder whether it might be better to do something like this:

var builder = DistributedApplication.CreateBuilder(args);
var provisioner = builder.AddAzureProvisioner(sub, rg, location);

var storage = provisioner.AddAzureStorage(name);
// or
var storage = builder.AddAzureStorage(name, provisioner); // provisioner would be an optional argument

The idea is that it allows the developer some control over which subscription and RG is used for a specific resource. We probably also want the ability to supply a Bicep fragment and pass in properties to that.

Comment thread src/Aspire.Hosting.Azure/AzureProvisioner.cs Outdated
Comment thread src/Aspire.Hosting.Azure/AzureProvisioner.cs
Comment thread src/Aspire.Hosting.Azure/AzureProvisioner.cs Outdated
Comment thread src/Aspire.Hosting.Azure/AzureProvisioner.cs Outdated
@davidfowl

Copy link
Copy Markdown
Contributor Author

I think we should allow overrides on the component AddX methods to override the resource group that is used.

Can they be successful using the provisioner at all? Why not have them not use it and get already provisioned resources?

@davidfowl

davidfowl commented Oct 2, 2023

Copy link
Copy Markdown
Contributor Author

The idea is that it allows the developer some control over which subscription and RG is used for a specific resource. We probably also want the ability to supply a Bicep fragment and pass in properties to that.

if we get this feedback from more people as they use it. I think we should make sub, region and location(s) to be required config and we can see what problems arise from there.

We can design more API if we need to.

FWIW: I prefer this one:

var builder = DistributedApplication.CreateBuilder(args);
var provisioner = builder.AddAzureProvisioner(sub, rg, location);

var storage = provisioner.AddAzureStorage(name);

- Make the subscription, and location/region optional.
@davidfowl
davidfowl merged commit a3dac0c into main Oct 2, 2023
@davidfowl
davidfowl deleted the davidfowl/azure-with-provisioning branch October 2, 2023 04:15
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2024
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants