-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Azure CLI "cors add" creates multiple entries of the same origin. #9778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting that, we will take a look and fix it in a future release |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ ahmedelnably, @fabiocav |
Also had this issue. Only an issue after updating to latest version (can't say which version introduced the issue as I was previously 4 versions out of date). |
Uggly workaround to check if origin is already set in PowerShell. $FunctionAppName = "foo"
$ResourceGroupName = "bar"
# Configure CORS for Function App
Write-Host "Set CORS in function app"
$allowedOrigins = "https://dev.azure.com","https://localhost:3000"
foreach ($item in $allowedOrigins) {
Write-Host "Check if allowedorigin '$item' is already set"
$missesOrigin = az functionapp cors show --name "$FunctionAppName" --resource-group $ResourceGroupName --query "contains(to_string(length(allowedOrigins[?contains(@, '$item')])),'0')"
if ($missesOrigin -eq "true") {
Write-Host "Add allowedorigin '$item'"
az functionapp cors add -n "$FunctionAppName" --allowed-origins $item
}
else {
Write-Host "Allowedorigin '$item' already set"
}
} |
Still an issue. I'm using a different workaround where I remove before adding. Seems to work fine since removing non-existing origins does not throw error or warning. |
@liron-navon Apologies for the delayed response. This GitHub issue has been open for quite some time. Could you please let us know if you still facing this issue and need assistance? Awaiting your reply. |
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Describe the bug
Calling "az functionapp cors add" from the CI/CD pipeline creates a new cors entry every time, instead of checking if the entry already exists.
This is important since I use it in the pipelines which are called every time the git repo is updated.
To Reproduce
Expected behavior
If I call
az functionapp cors add
multiple time, it should just create a single entry of the origin and not multiple.Environment summary
Azure pipeline
Additional context

Image from the azure dashboard
The text was updated successfully, but these errors were encountered: