On a FortiGate previously deployed on Azure, you can enable managed identities using different interaction methods, including the Azure portal, Azure CLI, PowerShell, or a REST API.
The most common method is to use the Azure portal. In the FortiGate-VM resource in the Azure portal, go to Identity. On the System assigned tab, toggle the Status to On.
You can adapt the following command to reflect your VM and resource group names. You can use this command in the Azure CLI installed on Azure Cloud Shell or your local system:
az vm identity assign -g myResourceGroup -n myVm