Share via

Set custom context in Azure Function using Powershell

Ana 141 Reputation points
2021-03-02T13:18:59.19+00:00

How can I set custom status using Powershell?

https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-custom-orchestration-status?tabs=csharp

I get property not found error, whether I try:
$context.setCustomStatus() or $context.CustomStatus = "bb"

The context doesn't even seem to have CustomStatus:

"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"Equals","MemberType":64,"Definition":"bool Equals(System.Object obj)"},{"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"GetHashCode","MemberType":64,"Definition":"int GetHashCode()"},{"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"GetType","MemberType":64,"Definition":"type GetType()"},{"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"ToString","MemberType":64,"Definition":"string ToString()"},{"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"CurrentUtcDateTime","MemberType":4,"Definition":"datetime CurrentUtcDateTime {get;}"},{"TypeName":"Microsoft.Azure.Functions.PowerShellWorker.Durable.OrchestrationContext","Name":"Input","MemberType":4,"Definition":"System.Object Input {get;}"}

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


1 answer

Sort by: Most helpful
  1. Mike Urnun 9,792 Reputation points Moderator
    2021-03-09T05:01:07.463+00:00

    Hello @Ana ,

    I believe the cmdlet that you're looking for is Set-DurableCustomStatus: https://github.com/Azure/azure-functions-powershell-worker/blob/dev/src/Durable/Commands/SetDurableCustomStatusCommand.cs#L13

    Please consider opening a new issue under the doc (the one you have referenced above) and submit a request for Powershell samples to be added -- that'll start an internal work item for us and we'd happy to make them available to you.

    UPDATE: here's a working sample: https://github.com/Azure/azure-functions-powershell-worker/blob/dev/examples/durable/DurableApp/CustomStatusOrchestrator/run.ps1

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.