I’m getting the following error when running a cmdlet to refresh a table in AAS via Devops CI/CD deployment pipeline.
##[error]Cannot connect to server ‘xxx’. Client with IP Address ‘20.68.178.187’ is not allowed to access the server. To enable access,
use the Firewall settings in Azure Management Portal. It may take up
to 5 minutes for this change to take effect.
The IP is from a Azure hosted build agent.
Is there a way to enable all Azure IPs in AAS in the same way that can done for Azure SQL here?
The other issue is that whenever we make a change to the AAS instance, the firewall rules get refreshed so we don’t want to have to add the Azure IPs each time.
2
Answers
Azure Hosted Agents uses set of public IP addressess from Azure Data Centers. So, you won’t be having one fixed IP set for your Azure Pipeline Agents. Unless, it’s a self-hosted agent. Azure maintains a public list of IP addressess for their Azure Data Centers represent via a Service Tag. Instead specifying all public IP addresses, you can use these service tag in your Azure PaaS service firewall setting to allow traffic.
You can download the list from here. https://www.microsoft.com/en-us/download/details.aspx?id=56519
For example if your Azure DevOps organization is from US geography you can use all the AzureCloud.{usregion} service tags to restrict traffic.
Further readings: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#to-identify-the-possible-ip-ranges-for-microsoft-hosted-agents
Based on your requirement, you can use the Azure PowerShell task in Pipeline to run the script to update the agent IP used for each run to the existing firewall rule.
Here are the steps:
Step1: Manully create a firewall rule in Analysis Services.
For example:
Step2: Create a .ps1 file in Azure repo with the following script:
Step3: Add Azure PowerShell task and define the arguments.
For example:
When you run the pipeline, it will update the existing firewall rule with the IP of the current agent.
Result:
In this case, you don’t need to manually add all IPs to firewall.