how execute PowerShell command in Azure Function Apps? - powershell

Azure have a built-in PowerShell in it's portal and you can write your commands directly from Portal without installing PowerShell in your system.
how I can write (execute) my PowerShell commands inside the function Apps?

This blog post may be able to help.
https://blogs.msdn.microsoft.com/powershell/2017/02/24/using-powershell-modules-in-azure-functions/

Related

How to execute a powershell script from AWS SSM document and store the output into a variable

I am writing an AWS SSM document and using PowerShell as a scripting language. My task is to execute a PowerShell script with parameters from the AWS SSM document and store the output of the executed PowerShell script in a variable.
I have already searched and got a couple of links but could not find the exact answer.
Please share any thoughts or any links.
Note: I am completely new in AWS and powershell

Scale up Azure Analysis service with Windows powershell

I'm working on a tabular model deployed on Azure Analysis Service.
We use Microsoft SSIS to load the DW and process the tabular model.
We now want to increase the QPU via SSIS or with a PowerShell script.
I found a script on SSIS http://microsoft-bitools.bl...
running a Powershell script via Runbook directly on Azure.
1- What's the difference between a Powershell script and a Powershell runbook script?
2- Do you know how I can do this task?
Thank you for your help.
For Q1, from the functional point of view, there is no difference between scaling up an Azure Analysis service using local Powershell script or using Azure automation Powershell runbook. Both of them will need to import Azure PowerShell modules and call functions.
For local Powershell script, you should install modules you need with command: Install-Module, and for Azure automation Powershell runbook, if you need some module, you can manage your modules on the Azure portal
For Q2, if you want to change your Analysis service pricing tier(SKU) to get more QPU, you can just use the PowerShell command below:
Set-AzAnalysisServicesServer -sku <sku name, such as B1,B2> -Name <your service name> -ResourceGroupName <the resource group name>
This is the reference of this command.
If you are not sure about how to use Azure PowerShell command, please see this official guide.

Azure Runbook - Create from gallery using a Powershell script

I was trying to create a RunBook in Azure Automation and I chose to use a Powershell script (Cmdlet). But the creation failed with an error because azure couldn't directly convert it and a manual edit is required to make it a "workflow". I am not a pro on PS and I understand you need to know how a workflow works. But my immediate goal is to get the Runbook working and hence trying to figure out an easy way to convert a PS script to a PS workflow for the purpose of runbook... Appreciate any help
Please see this blog post for info on PowerShell script to PowerShell Workflow conversion: http://azure.microsoft.com/blog/2014/11/25/introducing-the-azure-automation-script-converter/
However, regardless of conversion, you can't interact with local files on your computer from Azure Automation, so this script won't work. See https://social.msdn.microsoft.com/Forums/en-US/03a7aace-4e3e-4dab-9a8f-4ed1002fde4e/how-to-upload-files-from-users-machine-to-blob-storage-using-azure-automation?forum=azureautomation for more details.

How can I execute scripts in a code created powershell shell that has Host.Ui.prompt commands in it?

I have a Powershell Commandlet which prompts a user from a secure string based on a condition. Now I want to automate the testing of this commandlet for which I use a Powershell Remote Runspace to Invoke the commandlet. Currently it fails with this error.
Write-Host : A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows.
How can I automate this?
It sounds like you are running powershell via c#. You can't prompt the user for input from the powershell script. You either need to pre-provide the necessary info in the script, or prompt for the info from your application and then pass the info to the powershell script.
As ojk mentioned the easiest way to accomplish this would probably be to use a powershell function then pass the necessary parameters to it via the code.

Any PowerShell Command to Restart WebRole

Is there any PowerShell Command to restart the WebRole or Worker Role . Please let me know
-Mahender
If you're looking at Windows Azure PowerShell Cmdlets, the Command you want to use is Reset-AzureRoleInstance (http://msdn.microsoft.com/en-us/library/jj152835.aspx). If you're looking for 3rd party Cmdlets, you can check out Cerebrata's Azure Management Cmdlets as well. The Cmdlet to use there is "Restart-Role" (http://www.cerebrata.com/Products/AzureManagementCmdlets/Details.aspx?t1=0&t2=3)
Hope this helps.