Repository navigation
Closed
Labels
area-integrationsIssues pertaining to Aspire Integrations packagesIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using AzureIssues associated specifically with scenarios tied to using Azure
Milestone
Description
Today, Aspire resource names support hyphen - characters.
We take those resource names and use them for bicep variable names. For example:
This doesn't work well because when you use a - in the name, you don't get an error until you try to azd up.
var storage = builder.AddAzureStorage("my-storage").RunAsEmulator(container =>
{
container.WithDataBindMount();
});
var blobs = storage.AddBlobs("blobs");
builder.AddProject<Projects.AzureStorageEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(blobs);When you azd up, it produces:
Packaging services (azd package)
Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time.
ERROR: error executing step command 'provision': initializing provisioning manager: failed to compile bicep template: failed running bicep build: exit code: 1, stdout: , stderr: C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(2,7) : Warning no-unused-params: Parameter "location" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(4,7) : Warning no-unused-params: Parameter "principalId" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(6,7) : Warning no-unused-params: Parameter "principalType" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(8,10) : Error BCP028: Identifier "my" is declared multiple times. Remove or rename the duplicates.
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(8,12) : Error BCP068: Expected a resource type string. Specify a valid resource type of format "<types>@<apiVersion>".
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(8,12) : Error BCP029: The resource type is not valid. Specify a valid resource type of format "<types>@<apiVersion>".
C:\Users\eerhardt\AppData\Local\Temp\azd-infra2898406436\my-storage\my-storage.module.bicep(8,71) : Error BCP018: Expected the "=" character at this location.
We need to sanitize these names, probably by replacing - with _ (which is safe to do because bicep supports underscore, and Aspire doesn't support underscore).
cc David Fowler (@davidfowl) Mitch Denny (@mitchdenny) tg-msft
Metadata
Metadata
Assignees
Labels
area-integrationsIssues pertaining to Aspire Integrations packagesIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using AzureIssues associated specifically with scenarios tied to using Azure
Activity
Sanitize bicep indentifiers
Sanitize bicep indentifiers
Sanitize bicep indentifiers (microsoft#6116)