Skip to content

az keyvault certificate download crashes on Python 3.9 #16318

@christianfosli

Description

@christianfosli

Describe the bug
Trying to download a certificate with the az certificate download command, on azure cli 2.16 and python 3.9, crashes with the error module 'base64' has no attribute 'encodestring'

To Reproduce

  • Have python 3.9 and azure cli 2.16

  • Have a keyvault mykeyvault with a certificate mycert

  • az keyvault certificate download -n mycert --vault-name mykeyvault --file mycert.crt

Expected behavior

The certificate should be downloaded and stored as mycert.txt

Environment summary

  • Install Method: dnf package manager with the https://packages.microsoft.com/yumrepos/azure-cli yum repo

  • CLI Version:

    $ az --version
    azure-cli                         2.16.0
    
    core                              2.16.0
    telemetry                          1.0.6
    
    Extensions:
    azure-devops                      0.18.0
    
    Python location '/usr/bin/python3'
    Extensions directory '/home/cfosli/.azure/cliextensions'
    
    Python (Linux) 3.9.0 (default, Oct  6 2020, 00:00:00) 
    [GCC 10.2.1 20200826 (Red Hat 10.2.1-3)]
    
    Legal docs and information: aka.ms/AzureCliLegal
    
    Your CLI is up-to-date.
  • OS version: Fedora Linux 33 (which comes with Python 3.9 preinstalled)

  • Shell type: Bash

Additional context

The Python 3.9 release notes seem to describe the reason and fix quite well:

base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1, have been removed: use
base64.encodebytes() and base64.decodebytes() instead. (Contributed by Victor Stinner in bpo-39351.)

Metadata

Metadata

Assignees

Labels

KeyVaultaz keyvaultquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions