Azure/azure-functions-on-container-apps

Azure resources tags are not set

Closed this issue · 6 comments

When deploying a Functions on Container Apps resource with Bicep

resource acafunction 'Microsoft.Web/sites@2022-09-01' = {
  name: '${envName}${appName}'
  location: location
  tags: union(tags, {
      'azd-service-name': appName
    })
  kind: 'functionapp'
  properties: {
    name: '${envName}${appName}'
    managedEnvironmentId: containerAppsEnvironment.id

    siteConfig: {
      linuxFxVersion: 'DOCKER|${effectiveImageName}'
      appSettings: appSettings
    }
  }
}

the resource itself is deployed but the resource tags are not set.

That currently prevents me from using it with Azure Developer CLI which requires a certain azd-service-name tag:
ERROR: getting target resource: resource not found: unable to find a resource tagged with 'azd-service-name: acafdistributor'. Ensure the service resource is correctly tagged in your infrastructure configuration, and rerun provision


When trying to set this tag with Azure CLI

az resource tag --tags azd-service-name=acafdistributor --ids /subscriptions/{subscriptionId}/resourceGroups/kw-messdist-rg/providers/Microsoft.Web/sites/kw-messdistacafdistributor --debug

I get

azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'
Content: {"Code":"BadRequest","Message":"Invalid parameter. DefaultHostName is not supported for Azure Functions on Azure Container apps. Please retry the operation without DefaultHostName.","Target":null,"Details":[{"Message":"Invalid parameter. DefaultHostName is not supported for Azure Functions on Azure Container apps. Please retry the operation without DefaultHostName."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"Invalid parameter. DefaultHostName is not supported for Azure Functions on Azure Container apps. Please retry the operation without DefaultHostName."}}],"Innererror":null}

Also when trying to set the tag in Portal, the operation succeeds but tag is effectively not set.

Hi @KaiWalter - tags feature will be enabled soon! development is completed, once deployment completes we will be testing from portal, az cli and az resource tag . Please stay tuned!!

This feature is now available!!

Can you elaborate on what you mean by this - "Also when trying to set the tag in Portal, the operation succeeds but tag is effectively not set"?
@KaiWalter

@v-shenoy it means I was able to set the tag in the UI, it reports successful but when I refresh or check tags with API those were not persistet

@KaiWalter Can you please check if you are able to add tags to the resource.

@vishal1997 I checked and now resource tags are set with Bicep and Azure Developer CLI/Bicep - where I needed it.