Start/Stop Resource Group (Server PostgreSQL, Data Factory)

Latifa KOUHAFA 5 Reputation points
2023-05-16T09:04:40.8833333+00:00

Hello,

I have a resource group that contains a storage account, a server for postgreSQL, Data Factory in which I have created a pipeline.

I want to limit my costs for the server and I would like to set up a system of deactivation and activation in the hours off, I do not find how to do that. Also for the data factory, is there a way to do this?

Thank you

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vedant Desai 656 Reputation points
    2023-05-16T09:15:29.6366667+00:00

    Hey Latifa,

    Yes, you can set up a system to deactivate and activate your server and data factory during off-hours to limit your costs.

    To do this, you can use Azure Automation to create a schedule that runs a script to deactivate your server and data factory. The script can be as simple as:

    # Deactivate the server
    az vm stop --resource-group <resource-group-name> --name <server-name>
    
    # Deactivate the data factory
    az datafactory stop --resource-group <resource-group-name> --name <data-factory-name>
    
    

    You can then use Azure Automation to create a schedule that runs this script at a time when you know your server and data factory are not being used. For example, you could run the script at night when your server and data factory are not being used for business-critical applications.

    Here are the steps on how to create a schedule in Azure Automation:

    1. Go to the Azure portal and navigate to your Automation account.
    2. Click on the "Schedules" tab.
    3. Click on the "Add schedule" button.
    4. In the "Name" field, enter a name for your schedule.
    5. In the "Description" field, enter a description for your schedule.
    6. In the "Start time" field, enter the time when you want your schedule to start.
    7. In the "End time" field, enter the time when you want your schedule to end.
    8. In the "Recurrence" section, select the frequency at which you want your schedule to run.
    9. In the "Action" section, select "Run a script".
    10. In the "Script path" field, enter the path to the script that you want to run.
    11. Click on the "Create" button.

    Once you have created your schedule, it will start running at the time that you specified. The script that you specified will be run at the scheduled time.

    This will help you to limit your costs by deactivating your server and data factory during off-hours when they are not being used.

    Please don't forget to click on 130616-image.png

    and upvote 130671-image.png

    button if you find this helpful.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.