How to start & stop virtual machine(Integrated Run time) in Azure Data Factory pipeline

Muralidhar Reddy Narravula 1 Reputation point
2020-01-14T10:18:29.263+00:00

Hi Experts,

I have created a virtual machine for integration run time to connect a SAP Systems. Now I have started the VM so its ingesting data from SAP to ADLS.

Now i need to create an activity to stop VM after my ingestion in ADF pipeline. And also I need to create a activity to start the VM before ingestion starts in pipeline.

I am not getting any help on this to achieve. Your help is really appreciated.

Thanks
Muralidhar.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,215 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vaibhav Chaudhari 38,631 Reputation points
    2020-01-14T14:54:37.817+00:00

    You can create Azure runbook, add PowerShell code to turn on/off the VM and call it in ADFv2 using Webhook.

    How to start and stop virtual machines with Azure Automation

    Reference: To trigger runbook from ADFv2

    2 people found this answer helpful.
    0 comments No comments

  2. Higor Silva Grilo 66 Reputation points
    2020-08-05T20:34:27.927+00:00

    Hi VaibhavChaudhari,

    I've followed the tutorial on the link that you have mentioned, but i'm getting this error after try to run the runbook:

    RunbookFlow : Run Login-AzureRmAccount to login. At line:9 char:57 + <#-- Enable activity tracing to see error location --#> RunbookFlow ` + ~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Invoke-RunbookFlow], PSInvalidOperationException + FullyQualifiedErrorId : InvalidOperation,Orchestrator.GraphRunbook.Cmdlets.InvokeRunbookFlowCommand
    

    adding more information:
    I've created previously the Automation account and tried but with no success, the start or stop of some VM. after authenticate with the "AzureRunAsConnection" account i can't see others resource groups or list objects.
    Does anyone had an error like this? can anyone help to find the problem in order to get the objects or start some VM?

    I've tried with some code, but getting similar results

    $connectionName = "AzureRunAsConnection"
    
    "Logging in to Azure..."
    Connect-AzureRmAccount `
        -ServicePrincipal `
        -TenantId $servicePrincipalConnection.TenantId `
        -ApplicationId $servicePrincipalConnection.ApplicationId `
        -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 
    
    Start-AzureVM -ResourceGroupName $ResourceGroup -Name $VMName -Force
    

    When i do that, i get:

        Start-AzureVM : A parameter cannot be found that matches parameter name 'ResourceGroupName'.
        At line:65 char:19
        +     Start-AzureVM -ResourceGroupName $ResourceGroup -Name $VMName -Fo ...
        +                   ~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidArgument: (:) [Start-AzureVM], ParameterBindingException
            + FullyQualifiedErrorId : 
        NamedParameterNotFound,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.StartAzureVMCommand
    
    0 comments No comments