According to Microsoft,
Login brute forcing is one of the top ways IaaS VMs are compromised in the cloud.
Therefore, they recently posted about a feature in beta called, “Just in Time” (JIT) access. The premise is that, rather than leaving a port open 24/7, you instead create temporary firewall rules for only the time span for which you need them. The system will automatically delete the firewall rule once the time expires.
It is not uncommon for a security incident to be the result of a developer temporarily adding a firewall rule to work through an issue and then forgetting to delete the rule once they are done. By allowing permissions to be time bound, it removes the step of having to remember to go back and delete the rule in scenarios where you only need the rule for a few hours or a few days.
Harden Your Azure Infrastructure Using Azure Security Center Just-In-Time VM Access https://blogs.msdn.microsoft.com/mvpawardprogram/2018/01/09/just-in-time-access-azure-vms/
Just-in-Time VM Access can be requested using the Azure Portal or by PowerShell based on Role Based Access Control (RBAC) permissions. On the Configured tab you select the VM you want to access and click to Request access.
Then you select the ports and time range. And you’re done.