Skip to content

Commit c532a67

Browse files
author
ecfan
committed
Draft
1 parent e2716da commit c532a67

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

articles/logic-apps/add-run-powershell-scripts.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,32 @@ MyLogicApp
322322
- requirements.psd1
323323
```
324324

325+
## Authorize access to Azure resources with a managed identity using PowerShell
326+
327+
With a [managed identity](/entra/identity/managed-identities-azure-resources/overview), your logic app resource and workflow can authenticate and authorize access to any Azure service and Azure resource that supports Microsoft Entra authentication without including credentials in your code.
328+
329+
From inside the **Execute PowerShell Code** action, you can authenticate and authorize access with a managed identity so that you can perform actions on other Azure resources where you enabled access. For example, you can restart a virtual machine or get the run details of another logic app workflow.
330+
331+
To use the managed identity from inside the **Execute PowerShell Code** action, you must follow these steps:
332+
333+
1. [Follow these steps to set up the managed identity on your logic app and grant the managed identity access on the target Azure resource](authenticate-with-managed-identity.md?tabs=standard).
334+
335+
On the target Azure resource, review the following considerations:
336+
337+
- On the **Role** tab, selecting a **Contributor** role is usually sufficient.
338+
339+
- On the **Add role assignment** page, on the **Members** tab, for the **Assign access to** property, make sure that you select **Managed identity**.
340+
341+
- After you select **Select members**, on the **Select managed identities** pane, select the managed identity that you want to use.
342+
343+
1. In your **Execute PowerShell Code** action, include the following code as the first line:
344+
345+
```powershell
346+
Connect-AzAccount -Identity
347+
```
348+
349+
1. Now, you can use the modules and commandlets that you want to work with the Azure resource.
350+
325351
## Compilation errors
326352

327353
In this release, the web-based editor includes limited IntelliSense support, which is still under improvement. Any compilation errors are detected when you save your workflow, and the Azure Logic Apps runtime compiles your script. These errors appear in your logic app's error logs.

0 commit comments

Comments
 (0)