terricain / certbot-dns-azure

AzureDNS Certbot plugin
Other
33 stars 16 forks source link

TypeError: __init__() got an unexpected keyword argument 'credential_scopes' #15

Closed Exchizz closed 1 year ago

Exchizz commented 2 years ago

Hi,

When I try to use your plugin, i get the following exception:

2022-05-01 11:23:09,325:INFO:certbot._internal.auth_handler:Cleaning up challenges
2022-05-01 11:23:09,325:ERROR:certbot._internal.error_handler:Encountered exception during recovery: TypeError: __init__() got an unexpected keyword argument 'credential_scopes'
2022-05-01 11:23:09,326:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/local/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/main.py", line 1723, in main
    return config.func(config, plugins)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/main.py", line 1582, in certonly
    lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/main.py", line 141, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/client.py", line 513, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/client.py", line 441, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/client.py", line 493, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, self.config, best_effort)
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/auth_handler.py", line 86, in handle_authorizations
    resps = self.auth.perform(achalls)
  File "/usr/local/lib/python3.8/dist-packages/certbot/plugins/dns_common.py", line 76, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_azure/_internal/dns_azure.py", line 182, in _perform
    client = self._get_azure_client(subscription_id)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_azure/_internal/dns_azure.py", line 268, in _get_azure_client
    return DnsManagementClient(self.credential, subscription_id, None, self._arm_endpoint, credential_scopes=[self._arm_endpoint + "/.default"])
TypeError: __init__() got an unexpected keyword argument 'credential_scopes'
2022-05-01 11:23:09,326:ERROR:certbot._internal.log:An unexpected error occurred:
2022-05-01 11:23:09,326:ERROR:certbot._internal.log:TypeError: __init__() got an unexpected keyword argument 'credential_scopes' 

I try to obtain a certificate using the following command: certbot certonly --test-cert --authenticator dns-azure --preferred-challenges dns --noninteractive --agree-tos --email test@test.dk --dns-azure-config /etc/azure.ini -d "test.certificate.com"

My /etc/azure.ini has the following:

dns_azure_msi_client_id = <client id of user assigned identity>
dns_azure_zone1 = certificate.com:/subscriptions/<subscription>/resourceGroups/<resource group>

Installed versions: user@host:/home/adm# pip list | grep -E "certbot|azure-mgmt-dns" azure-mgmt-dns 8.0.0 certbot 1.26.0 certbot-dns-azure 1.5.0

Python 3.8.10 Ubuntu 20.04.4 LTS

Exchizz commented 2 years ago

Hi,

I had to remove credential_scopes from DnsManagementClient (...). It then complained about missing signed_session method which seems to be due to MS's new authentication-stuff....

I've used the wrapper from here: https://stackoverflow.com/a/64923028/1493471

PR: https://github.com/terrycain/certbot-dns-azure/pull/16

terricain commented 1 year ago

Is this still a problem?