Introduction
Working with DNS in a cloud environment can be challenging, especially when integrating Platform as a Service (PaaS) services, such as Azure Storage or Azure SQL Database, into the network. In this article, we will explore how Azure Policy can help automate and streamline this process.
The Problem
For many enterprises, using PaaS services is a must. However, integrating them into the network can be challenging. An important part of the integration is making sure that the DNS works as intended. In Azure, this means creating private endpoints to integrate the PaaS services into the network without creating a lot of public IP addresses.
There are many scenarios for DNS, but one that many people struggle with is when there is a central IT team managing the network topology and, with it, the DNS servers and private DNS zones. To use private endpoints in Azure, they need to be connected to a subnet and a DNS record needs to be registered in a private DNS zone. These private DNS zones are global resources and should be connected to a hub network. This means that developers do not have permission to register DNS records in the private DNS zone and must depend on the central IT team.
Many enterprises have different approaches to solving this problem, often using large ITSM tools or other processes. However, this problem can easily be automated and solved using Azure Policy.
The Solution: Azure Policy
Azure Policy puts more responsibility on developers by allowing them to set up PaaS services and integrate them into the network they have access to. The services are then automatically connected to the rest of the network. The most common case is the use of storage accounts, which we will use as an example here.
A big shout out to the developers of the Azure Landing Zone policy set. The policy that automatically ensures the registration of DNS records in the private DNS zone is from that set. You can find information about it here. They have developed a Policy Initiative that contains policies that ensure the registration of DNS records in the private DNS zone.
How to implement the policy
To implement the policy, first deploy the definition on a management group or other appropriate scope. Then, assign the policy to the desired management groups or subscriptions using a managed identity. Make sure that the managed identity has the necessary permissions to register DNS records in the private DNS zone (i.e., Private DNS Zone Contributor permission).
Example
If a developer wants to create a storage account that is integrated with the network, they can follow this simple process:
- Create a storage account.
- Set network access to “disable public access” and use “private access”.

- Create a private endpoint.
- Ensure that the toggle function for integrating with private DNS zones is turned off (having it on requires sufficient permission to register DNS records in the private DNS zone).
After creating the storage account, the policy will detect that you have created a private endpoint and register the DNS record in the private DNS zone. This can take some time, but within 30 minutes you should see the DNS record in the private DNS zone.

Using this sort of automation greatly streamlines the process of integrating PaaS services into the network. It shifts responsibility from central IT teams to developers, allowing them to work more independently and effectively. It also removes a tedious and annoying part of development for developers – waiting for someone else to register records in private DNS zones – which can be both irritating and costly for enterprises.
Conclusion
In conclusion, using Azure Policy to automate DNS integration with PaaS services can greatly streamline the process and make it more efficient. It also shifts responsibility from central IT teams to developers, allowing them to work more independently and effectively.
I hope this revised version of your blog article meets your needs! Let me know if you have any questions or if there’s anything else I can do to help.
Legg igjen en kommentar