@Andrea Longhitano Thanks for reaching out. Yes, it is possible to use a Network Security Group to allow API calls only from specific IP addresses.
Determine the IP address or IP address range that you want to allow traffic from. In your case, you can use the Service Tag of Dynamics 365 to determine the IP address range.
Create a new NSG rule that allows traffic from the IP address or IP address range that you want to allow. You can create this rule in the Azure portal by navigating to the NSG resource, selecting "Inbound security rules", and clicking "Add".
Apply the NSG to the APIM instance. You can do this by associating the NSG with the subnet that the APIM instance is deployed to.
Once you have applied the NSG to the APIM instance, only traffic from the specified IP address or IP address range will be allowed to access the APIM instance.
do let me know incase of further queries, I would be happy to assist you.