Azure Logic Apps and VMs - azure

I'm searching for some ideas, how to create an logic app which can turn on/off a VM.
Microsoft Azure team answered on a similar question a couple of months ago, but no any results till today. Does anybody have an idea, is there a way to implement it?
Thanks in advance.

Easiest way - create a webhook that will call an Azure Function that will shutdown a VM.

You could also use the Azure Automation service/connector from logic apps to run a PowerShell script to shut down a VM. Azure Automation has some samples in their gallery that do this.

Related

Can we develop Azure function in both portal and VS at a time?

I'm working on HTTP trigger Azure function(C# language).
I have one doubt, Can we develop the code of same azure function in both Azure Portal and Visual studio?
Or only at one place the editing is possible based on the function creation place?
Could someone clarify on this.
As peter bons said in the comment, develop Azure function in both portal and VS at a time is impossible.
And if you are based on C#, there is no way to develop function on portal. Only C# script can do.
But you can remote debug on VS:
https://www.linkedin.com/pulse/remote-debug-your-azure-function-app-v2-visual-studio-krish

Can you add Defender to an Azure Sql Database with the CLI, ARM or Powershell?

I found this connect request to add it, but it doesn't say anything about Powershell. I'm guessing it's not available yet, but can anyone confirm that?
https://feedback.azure.com/forums/34192--general-feedback/suggestions/42407380-enable-azure-defender-for-sql-using-cli-or-arm-tem
-Randy
Azure Defender only provide the Portal way to enable the defender for Azure SQL database.
There isn't a CLI, ARM or Powershell way to add it. We can continue to vote the feedback that product team could see it and give us the answer.
The directly way to get answer is ask Azure Support, but it takes money and time. If you need, you could think about that.
HTH.

Is there any API or Automation for MS Azure Migrate?

I came across the Azure Site Recovery runbook scripts to perform various task but now MS recommend using Azure Migrate instead of ASR for migration projects. Any one know if there are any API, ARM, scripts or runbook capability available for Azure Migrate Automation? I haven't been able to find anything.
Anything information on this would be greatly appreciated. Thanks,
Here are the set of API's for migrate projects. For more information related to Azure Migrate, please refer this official documentation.
For any one looking into this there is finally PowerShell modules to handle this: https://azure.microsoft.com/en-us/blog/atscale-migration-automation-support-with-azure-migrate-and-azure-powershell/

Is it possible to stop/start an Azure ARM Virtual Machine from an Azure Function?

Runbooks can be used to stop/start classic and ARM Virtual Machines in Azure.
Is this also possible from an Azure Function?
Some good news to update this thread. You will be able to do that now in Azure Functions. The steps are documented here based on HTTP-triggered Functions.
Azure Function role like permissions to Stop Azure Virtual Machines
You may switch out the trigger type to fit your use-case.
See Ling's response above. We've addressed this now. :)
It's not currently possible to do this via the Azure PowerShell commandlets in Azure Functions. You can write against the Azure C# SDK or use the x-plat CLI (if you bring it yourself, as it isn't installed by default). You'll need to upload a cert or use a service account to perform those actions.
FYI - I'm on the Functions team and we're working on improving this story, in the near future. I'll update this answer once it's been made possible.
You can either use the Azure REST API from here -> Docs or make use of the SDK to do the operations.

Create virtual machines with Windows Azure php sdk

I am trying to figuring out how to create virtual machines with windows azure php sdk https://github.com/Azure/azure-sdk-for-php , I can't seem to understand on how to do this as there is any mention about virtual machines in the sdk.
Any help will be very apreciated.
Thanks
The Azure-SDK-for-PHP offers Service Management (see https://github.com/Azure/azure-sdk-for-php/blob/master/README.md) to spin up app services or VM’s. I’m not sure if it already includes support for managing Docker containers, but since it’s all REST API in the background, it should not take too much time to write a few lines to have it do the same thing. But for VM’s you can definitely manage them through the SDK.
If you need code samples, ping me. I’d love to share my knowledge.
I think azure-php-sdk is for using azure storage etc. it's not for creating VM.
Normally to create VM throught management portal and Windows azure powershell.

Resources