Skip to content

[BUG] WebActivityAuthentication Username property does not allow for expressions #37749

Open
@mikegoatly

Description

@mikegoatly

Library name and version

Azure.Analytics.Synapse.Artifacts 1.0.0-preview.17

Describe the bug

The Username property on WebActivityAuthentication is defined as a string:

public string Username { get; set; }

However in Synapse this property can be defined as an expression, and when this is the case, deserialization fails with the following error:

Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: The requested operation requires an element of type 'String', but the target element has type 'Object'.
   at System.Text.Json.JsonDocument.GetString(Int32 index, JsonTokenType expectedType)
   at Azure.Analytics.Synapse.Artifacts.Models.WebActivityAuthentication.DeserializeWebActivityAuthentication(JsonElement element)
   at Azure.Analytics.Synapse.Artifacts.Models.WebActivity.DeserializeWebActivity(JsonElement element)
   at Azure.Analytics.Synapse.Artifacts.Models.Activity.DeserializeActivity(JsonElement element)
   at Azure.Analytics.Synapse.Artifacts.Models.ForEachActivity.DeserializeForEachActivity(JsonElement element)
   at Azure.Analytics.Synapse.Artifacts.Models.Activity.DeserializeActivity(JsonElement element)
   at Azure.Analytics.Synapse.Artifacts.Models.PipelineResource.DeserializePipelineResource(JsonElement element)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Microsoft.Azure.Commands.Synapse.Common.JsonConvert.DeserializeObject[T](String rawJsonContent)
   at Microsoft.Azure.Commands.Synapse.Models.SynapseAnalyticsArtifactsClient.CreateOrUpdatePipeline(String pipelineName, String rawJsonContent)
   at Microsoft.Azure.Commands.Synapse.SetAzureSynapsePipeline.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()

Expected behavior

No exception should be thrown when deserializing a WebActivityAuthentication when the user name is set to an expression.

Actual behavior

An exception is thrown.

Reproduction Steps

  1. Define a pipeline in Synapse that uses a WebActivity and sets the username property to an expression, e.g. bind it to a parameter or variable
  2. Deserialize the pipeline's JSON using the SDK
  3. The exception is thrown

Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.Synapsecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions