Scheduling access to SSH on Azure

I have the need to automatically dump a MySQL database on one server with mysqldump, copy it to another server (probably using rsync), and then import it on the server it was copied to with mysql.

Due to some attacks on the platform in question, as well as it being good practice, SSH is closed unless required to be open for maintenance or code deploys.

How can I automate opening of SSH on Azure to allow my scripts and commands to run and close after? Or is there a way to do the above without SSH?


If your needing to do this at a fixed time then I would recommend using either Azure Automation or an Azure Function on a timer trigger. You can schedule this to run at a specific time and call into Azure using the Azure PowerShell Cmdlets or REST API to open up the network security group at a specific time, and close it again later.