Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
86 stars 27 forks source link

Deploying Digital Twin Endpoints does not work through symbolic reference #2262

Open ogiel opened 2 months ago

ogiel commented 2 months ago

Bicep version Bicep CLI version 0.15.31 (3ba6e06a8d)

Describe the bug Creating endpoints for Azure Digital Twins (ADT) by using symbolic links to an existing ADT instance does not work, but it does work when the ADT instance is created within the same deployment.

To Reproduce What works:

resource newDigitalTwinsInstance 'Microsoft.DigitalTwins/digitalTwinsInstances@2023-01-31' = {
  name: newDigitalTwinsInstanceName
  location: 'westeurope'
}

resource endpoint 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31' = {
  parent: newDigitalTwinsInstance
  name: endpointName
  properties: {
    authenticationType: 'KeyBased'
    endpointType: 'EventGrid'
    TopicEndpoint: TopicEndpoint
    accessKey1: '(PLACEHOLDER)'
    accessKey2: '(PLACEHOLDER)'
  }
}

What does not work but is expected to work:

resource existingDigitalTwinsInstance 'Microsoft.DigitalTwins/digitalTwinsInstances@2022-10-31' existing = {
  name: existingDigitalTwinsInstanceName
}

resource endpoint 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31' = {
  parent: existingDigitalTwinsInstance
  name: endpointName
  properties: {
    authenticationType: 'KeyBased'
    endpointType: 'EventGrid'
    TopicEndpoint: TopicEndpoint
    accessKey1: '(PLACEHOLDER)'
    accessKey2: '(PLACEHOLDER)'
  }
}

Additional context When using symbolic reference it throws the error:

{"code": "MissingArgument", "message": "Target - '<ADT_NAME/ENDPOINT_NAME>'. Input parameter 'source' is missing."}
anthony-c-martin commented 2 months ago

@ogiel would you mind sharing the correlationId for this failure?

ogiel commented 2 months ago

@anthony-c-martin not 100% which correlationId you mean but I get this when I try to deploy it through symbolic reference: x-ms-correlation-request-id: e96f04fb-88c1-4bb4-b27b-528d1ead356a

The deployment itself does not fail because it will not start. It says there is an InvalidTemplateDeployment (which is not the case when not using symbolic reference to the same ADT instance).

anthony-c-martin commented 2 months ago

@ogiel we will follow up internally with the team who owns this API and get back to you.

/cc @stephaniezyen

krbar commented 1 month ago

@anthony-c-martin We are facing the same issue in Azure Verified Modules. Our validation workflow for the Digital Twins Module fails since a while, preventing us from publishing newer module versions into the Public Bicep Registry.

In our case, the EventGrid endpoint deploys fine, but EventHub and ServiceBus endpoints fail. Our last failed run: https://github.com/Azure/bicep-registry-modules/actions/runs/10653937501/job/29529750244#step:4:775

If necessary I can prepare a simplified repro-example.

johngallardo commented 4 days ago

This works if the Event Grid resource is also referenced symbolically to resolve the topic name, e.g.:

resource digitalTwins 'Microsoft.DigitalTwins/digitalTwinsInstances@2022-05-31' existing = {
  name: digitalTwinsInstanceName
}

resource eventGridTopic 'Microsoft.EventGrid/topics@2022-06-15' existing = {
  name: eventGridTopicName
}

resource endpoint 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31' = {
  parent: digitalTwins
  name: endpointName
  properties: {
    authenticationType: 'KeyBased'
    endpointType: 'EventGrid'
    TopicEndpoint: eventGridTopic.properties.endpoint
    accessKey1: '(PLACEHOLDER)'
    accessKey2: '(PLACEHOLDER)'
  }
}