Windows Server Posted January 24 Posted January 24 This is a fairly short post, but in my last post about deploying a Logic Apps Standard using Managed Identity and private networking, I'd mentioned the customer needed to run some automation tasks. Some of these tasks pertained to maintenance within their application, but some were cleaning up unused resources in Azure, specifically removing stale containers in blob storage. However, when trying to run the Remove-AzStorageContainer PowerShell cmdlet, we got the following error: "The term 'Remove-AzStorageContainer' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."By default, the PowerShell Connector in Logic Apps does not include the Az PowerShell module. To enable this (or other PowerShell modules you want to use): Open Kudu and open a CMD or PowerShell console Navigate to site/wwwroot Open the host.json file and ensure that you see a property "managedDependency":{"enabled":true} (this is the default and should be present). Open the requirements.psd1 file and add any PowerShell modules and version you want installed, e.g. 'Az' = '12.*' Save the file and restart the web service After that, you can add the Execute PowerShell Code connector. To use a Managed Identity as the user context for performing tasks in Azure, add the following line at the beginning of your script: Connect-AzAccount -Identity -Environment AzureUSGovernment Enjoy!View the full article Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.