-
-
Notifications
You must be signed in to change notification settings - Fork 821
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
why need Azure Resource Group Permission? #2372
Comments
I'd happy to accept a PR if you can find a better way to do it. Frankly of all DNS API's that I've seen in the course of maintaining this project, Microsofts one has been by far the worst one to deal with. As far as I know, even when the name of the zone is known, I still have to get a I haven't found a way to materialize a The |
Hi @WouterTinus I was looking at this same update for Certify The Web recently and while their docs all do use the resource method I found you could avoid extra permissions by going via the subscription. Along the lines of:
|
Hi Christopher, that may be a solution for the regular case, but I have some users (like OP) saying that they don't want to grant permission to enumerate all zones, so instead they provide the name of a specific zone that they want used. It seems to me that you either need the zone enumeration permission or the resource group permission. It would be nice if on enumeration Microsoft would At this point I'm happy that the plugin works, I'm not inclined to refactor again and deal with potential fallout from that to avoid granting some harmless permission. I'd sooner suggest moving to a decent DNS provider that at least support DNSSEC 😄 |
Cool, it's just that the DNS contributor role is the one that doesn't allow the resource query so users will have to update their IAM settings for their application user. In CTW we take a zoneid for some providers, in the case of Azure that can be the zone name so you could do similar (let them specify the zone name and therefore skip the zone query), but yes Azure is one of the more complicated DNS providers and their API is a bit cumbersome! |
So are you saying that when getting the list from the subscription it doesn't require specific enumeration access? It would just return the zone(s) that one has contributer access to? |
The DNS contributor role allows listing the zones but I don't know what it does for zones you can't update, however the old API certainly works ok with that role without complaints. |
Hi @sveng-r - I've kicked off a build using the technique suggested by @webprofusion-chrisc, would you mind to test if this works with minimal permissions as you expected it to? https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/46993810/artifacts |
Sorry for coming back so late. We removed the permissions for the managed identy on the resource group, leaving only "DNS Zone Contributor" role on the specific DNS Zone and let my customer test. He said he got some errors, but in the end the certificate renewal was sucessfull. So this fix looks fine for me so far.. thx alot. He also gave me the log file in case it is of any help, all sensitiv data should be masked with XXXXXXXXXX |
If you already know the subscription ID and set that when setting up the arm client then GetDefaultSubscriptionAsync() just returns that one.
Maybe GetSubscriptions() isn't working if you just have DNS Zone Contributor. So I'm thinking you could just have |
Hate to dissapoint you, but the only reason that worked was because the authorization result was still cached (at Let's Encrypt). That build will more than likely fail for the next renewal. Chris' suggestions look good but I'll need to find some time to look into them. |
This build might do the trick, we don't look at the resource group at all and only request for the default subscription: https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/47008072/artifacts |
my customer tried again with Option "T: Run the renewal (force, no cache)" it worked and he got:[DBUG] [XXXXXXXXXX.net] Attempting to create DNS record under _acme-challenge.XXXXXXXXXX.net...
|
That was an stupid typo. I've fixed it and also managed to access my own Azure environment for testing, it seems that this build works better: https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/47033743/artifacts |
Fix included in 2.2.5 |
It looks like this was not properly merged for the 2.2.5 release, so it will only be included in 2.2.6. |
Describe the bug
We are using the latest win-acme (v2.2.4.1500) version and try to renew a certificate for azure dns using a managed identy:
--validation azure --azureusemsi --azuresubscriptionid x --azureresourcegroupname x --azurehostedzone x
The managed identy does have DNS Zone Contributor rights on the Azure DNS Zone ... but not on the Resource Group. When we try to renew certificate we get:
Azure.RequestFailedException: The client 'XXXXXXXX-XXXX-XXXXX-XXXXX-XXXXXXXXXXXX' with object id 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourcegroups/read' over scope '/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourcegroups/XXXXXX' or the scope is invalid. If access was recently granted, please refresh your credentials. Status: 403 (Forbidden) ErrorCode: AuthorizationFailed
so it seems win-acme tries to scan the resource group for the specific dns zone, even when we give the name of the zone.
So we gave the identy reader rights on the resource group and then it works.
Expected behavior
win-acme should be able to handle certificates when only having the correct rights on the azure dns hosted zone without permissions on the resource group.
The text was updated successfully, but these errors were encountered: