In that case, you need to create the NSG and associate your VMs if there is no NSG. Now, block the port 80/443 and allow only specific ports of azure which will fix the issue.
Click on the VMs
Click on the networking tab
Click on the NSG
Then create the Outbound deny rule for the internet.