Skip to content

New command: m365 flow set #6975

@mkm17

Description

@mkm17

Usage

m365 flow set [options]

Description

Sets the specified Power Automate flow

Options

Option Description
-n, --name <name> The name of the Power Automate flow to update.
-e, --environmentName <environmentName> The name of the environment that contains the flow.
--definition <definition> A JSON string containing the new flow definition to set.
--publish Publishes the flow.
-f, --force Don't prompt for confirmation when warnings occur.

Examples

Set a new definition for the specified flow and save it as a draft

m365 flow set --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d --definition '{\"properties\":{\"definition\":{\"$schema\":\"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#\",\"actions\":{\"Compose\":{\"type\":\"Compose\",\"inputs\":\"test\",\"runAfter\":{},\"metadata\":{\"operationMetadataId\":\"4f25ab1c-549e-4eaf-9980-c03020e55378\"}}},\"parameters\":{\"$authentication\":{\"defaultValue\":{},\"type\":\"SecureObject\"}},\"triggers\":{\"manual\":{\"type\":\"Request\",\"kind\":\"Button\",\"inputs\":{\"schema\":{\"type\":\"object\",\"properties\":{},\"required\":[]}},\"metadata\":{\"operationMetadataId\":\"1b2caf01-8e22-45eb-8646-77168ad14bdd\"}}},\"contentVersion\":\"1.0.0.0\",\"outputs\":{}},\"connectionReferences\":{},\"displayName\":\"Test Flow\",\"templateName\":\"\",\"environment\":{\"name\":\"Default-d87a7535-dd31-4437-bfe1-95340acd55c5\"}}}'

Set a new definition for the specified flow and publish it

m365 flow set --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name 3989cb59-ce1a-4a5c-bb78-257c5c39381d --definition '{\"properties\":{\"definition\":{\"$schema\":\"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#\",\"actions\":{\"Compose\":{\"type\":\"Compose\",\"inputs\":\"test\",\"runAfter\":{},\"metadata\":{\"operationMetadataId\":\"4f25ab1c-549e-4eaf-9980-c03020e55378\"}}},\"parameters\":{\"$authentication\":{\"defaultValue\":{},\"type\":\"SecureObject\"}},\"triggers\":{\"manual\":{\"type\":\"Request\",\"kind\":\"Button\",\"inputs\":{\"schema\":{\"type\":\"object\",\"properties\":{},\"required\":[]}},\"metadata\":{\"operationMetadataId\":\"1b2caf01-8e22-45eb-8646-77168ad14bdd\"}}},\"contentVersion\":\"1.0.0.0\",\"outputs\":{}},\"connectionReferences\":{},\"displayName\":\"Test Flow\",\"templateName\":\"\",\"environment\":{\"name\":\"Default-d87a7535-dd31-4437-bfe1-95340acd55c5\"}}}' --publish

Default properties

Additional Info

Hi,

I noticed that before adding or updating a flow, two calls are made: checkFlowWarnings and checkFlowErrors. I think it’s worth checking the status of warnings and errors before updating the flow. Maybe, in case of a warning, we could prompt the user for confirmation.

Let me know what you think about this command. I’d also like to add a flow add command with a similar structure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions