az vm update --name <vm_name> --resource-group <resource_group_name> --set "properties.securityProfile.securityCenterEnabled=true"
to enable Azure Security Center for a specific virtual machine.az network nsg rule create --name <rule_name> --nsg-name <nsg_name> --resource-group <resource_group_name> --priority <priority_number> --source-address-prefixes <source_address_prefix> --destination-port-ranges <destination_port_range> --access <access_type> --protocol <protocol>
to create a new NSG rule for a specific NSG and virtual machine.az backup protection enable-for-vm --vm <vm_name> --resource-group <resource_group_name> --policy-name <policy_name>
to enable Azure Backup protection for a specific virtual machine. Replace <policy_name>
with the name of the backup policy you want to apply.<vm_name>
, <resource_group_name>
, <rule_name>
, <nsg_name>
, <priority_number>
, <source_address_prefix>
, <destination_port_range>
, <access_type>
, and <protocol>
should be replaced with the appropriate values specific to your environment.
azure-mgmt-compute
library to create virtual machines with the desired configurations, such as specifying the VM size, OS image, and network settings.azure-mgmt-security
library.