-
Notifications
You must be signed in to change notification settings - Fork 267
Closed
Description
Currently, if you provision a Function App with azd, on azd down it shows the resource type as "Web App" instead of "Function App":
It might be because in generateResourcesToDelete, we use the simple translation instead of the dynamic one:
azure-dev/cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go
Lines 1053 to 1060 in d2271fe
| for _, resource := range resources { | |
| resourceTypeName := azapi.GetResourceTypeDisplayName(azapi.AzureResourceType(resource.Type)) | |
| if resourceTypeName == "" { | |
| continue | |
| } | |
| lines = append(lines, fmt.Sprintf(" • %s: %s", resourceTypeName, resource.Name)) | |
| } |
Dynamic lookup:
azure-dev/cli/azd/pkg/infra/azure_resource_manager.go
Lines 210 to 239 in d2271fe
| func (rm *AzureResourceManager) GetResourceTypeDisplayName( | |
| ctx context.Context, | |
| subscriptionId string, | |
| resourceId string, | |
| resourceType azapi.AzureResourceType, | |
| ) (string, error) { | |
| if resourceType == azapi.AzureResourceTypeWebSite { | |
| // Web apps have different kinds of resources sharing the same resource type 'Microsoft.Web/sites', i.e. Function app | |
| // vs. App service It is extremely important that we display the right one, thus we resolve it by querying the | |
| // properties of the ARM resource. | |
| resourceTypeDisplayName, err := rm.getWebAppResourceTypeDisplayName(ctx, subscriptionId, resourceId) | |
| if err != nil { | |
| return "", err | |
| } else { | |
| return resourceTypeDisplayName, nil | |
| } | |
| } else if resourceType == azapi.AzureResourceTypeCognitiveServiceAccount { | |
| resourceTypeDisplayName, err := rm.getCognitiveServiceResourceTypeDisplayName(ctx, subscriptionId, resourceId) | |
| if err != nil { | |
| return "", err | |
| } else { | |
| return resourceTypeDisplayName, nil | |
| } | |
| } else { | |
| resourceTypeDisplayName := azapi.GetResourceTypeDisplayName(resourceType) | |
| return resourceTypeDisplayName, nil | |
| } | |
| } |