# azure


10/09/2020, 10:48 AM
Hi All, I'm having trouble specifying the definition for a Logic App Workflow in C# as per Resource Workflow | Module logic | Package Azure NextGen | Pulumi. The Definition wants something of Pulumi.Input<object> but I haven't worked out the correct format. I have tried passing in a System.Text.Json.JsonElement created by Deserializing
Without luck (I get an error saying that the property $schema wasn't found in the JSON (though I can access it via GetProperty("$schema")). Does anyone know the correct format? I've tried the example code from the above link but that won't build


10/09/2020, 11:51 AM
Yeah, it looks like the Azure API spec isn’t great there, so we generate an untyped object. Do you have a sample for me to try?
Feel free to add your code based on JsonElement and I will try it too


10/09/2020, 3:59 PM
Thanks @tall-librarian-49374, That's a bit more direct than what I was trying 🙂 I was starting with the following class
Copy code
internal class AzureWorkflowModel
    public string schema { get; set; } = "<>";
    public object actions { get; set; } = new object();
    public object parameters { get; set; } = new object();
    public object triggers { get; set; } = new object();
    public string contentVersion { get; set; } = "";
    public object outputs { get; set; } = new object();
and then doing a bit of ugly conversion to get it to a JsonElement
Copy code
var laDefinition = JsonSerializer.Serialize(new AzureWorkflowModel());
var laDefinitionJsonElement = JsonSerializer.Deserialize<System.Text.Json.JsonElement>(laDefinition);
the above then allows me to correctly access the $schema property
Copy code
But passing it in to the following code results in the error reported above
Copy code
return new Pulumi.AzureNextGen.Logic.Latest.Workflow(myName, new Pulumi.AzureNextGen.Logic.Latest.WorkflowArgs
    WorkflowName = myName,
    Location = myLocation,
    ResourceGroupName = myResourceGroupName,
    laDefinition = laDefinitionJsonElement