az storage account network-rule not working for Microsoft Hosted agent(Azure DevOps)

谁都会走 提交于 2021-02-19 09:01:38

问题


I have to delete all the files in azure blob storage(specific container) automatically via azure release pipelines. So I have configured a task to get the IP address of Microsoft agent dynamically and add the IP address into blob Firewall. Below script working successfully sometimes, but I'm not able to see the IP in the Firewall list.

Also same script is failing many times and throwing a error like

The request may be blocked by network rules of storage account. Please check network rule set using 'az storage account show -n accountname --query networkRuleSet'.If you want to change the default action to apply when no rule matches, please use 'az storage account update'.

IP=`curl -s http://ipinfo.io/json | jq -r  '.ip'`


echo "Opening firewall for the IP : $IP"

az storage account network-rule add -g custom-web --account-name   "customwebapp" --ip-address $IP

I'm not sure on this , Any one able to advise me a best way to achieve this or Another alternate secure way for connecting the azure blob via Microsoft hosted agent ?

References https://docs.microsoft.com/en-us/cli/azure/storage/account/network-rule?view=azure-cli-latest

来源:https://stackoverflow.com/questions/66196473/az-storage-account-network-rule-not-working-for-microsoft-hosted-agentazure-dev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!