How to automatically add your DevOps IP to Azure Analysis Services Firewall

Without adding the complete range of the datacentre

Arthur Steijn
3 min readJul 17, 2020
Photo by Ivan Bandura on Unsplash

Since October 2017 it is possible to configure a firewall on your Azure Analysis Services. It is recommended to do this, since it adds an extra layer of protection to your AAS. By default, AAS accepts all incoming network traffic from any client.

To be honest the firewall has very basic functionalities. Apart from on or off, there is a ‘Allow access from the Power BI Service’ button. Which I’m happy with is there, since it makes life a little bit easier. And there is functionality to add and delete IP-ranges. It does not have an option, like Azure SQL Server, to ‘allow all azure services’ (Basically, this adds all MS Azure Datacentres to a rule, not limited to your own subscription).

In this particular case I’m using Azure DevOps for my repo and Azure Pipelines for a Continuous Integration and Delivery strategy. To manage the model, we have configured a couple of Logic Apps, in combination with the REST API, to Resume, Suspend and Refresh the model.

So, enabling the Firewall on my AAS means that these clients, are not able to do their work unless we add their IP address to the Firewall config. In this example we will focus on Azure DevOps and how to allow traffic from the agent used in our CI/CD process.

The introduction article has some suggestions on how to overcome this problem. But also states, it is recommended to limit the number of rules to the absolute necessary.

So how do we bring this back to just one rule?! Here is how we solved it.

The PowerShell script

The solution we implemented, involves a PowerShell script to set the firewall config. Apparently, more people run into the same challenge. We reused and altered the script a bit. The original is linked below.

Currently it is not possible to alter or delete a single rule with the available PowerShell cmdlets. The only available commands are New-AzAnalysisServicesFirewallRule and New-AzAnalysisServicesFirewallConfig.

The script takes the currently applied firewall rules and the setting for the Power BI service. Stores these rules and updates the public IP address for the defined rule if needed and sets the firewall config on the Analysis Services.

Azure Pipelines Task

We added an Azure PowerShell Task to the tasks of our deployment pipeline. This step is executed before the deployment of the model.bim. Make sure the service connection has the appropriate permissions on the AAS to perform the actions defined in the PowerShell script. You can find an example in yaml in my GitHub project.

Hopefully this article will make implementing the firewall a litte easier! And please let me know if you see any posible improvements!



Arthur Steijn

Microsoft-oriented Data/DevOps/Cloud Engineer, always looking for new and exciting techniques to improve processes and deliver fast and reliable data pipelines