def _GenerateSSHKeyPair(vm_name: str) -> str:
  """Generate a SSH key pair and returns its public key.

  Both public and private keys will be saved in the current directory.

  Args:
    vm_name (str): The VM name for which to generate the key pair.

  Returns:
    str: The public key for the generated SSH key pair.

  Raises:
    ValueError: If vm_name is None.
  """
  if not vm_name:
    raise ValueError('Parameter vm_name must not be None.')

  logger.info('Generating a new SSH key pair for VM: {0:s}'.format(vm_name))

  key = RSA.generate(2048)
  key_name = '{0:s}-ssh'.format(vm_name)

  public_key = key.publickey().exportKey('OpenSSH')
  path_public_key = os.path.join(os.getcwd(), key_name + '.pub')

  private_key = key.exportKey('PEM')
  path_private_key = os.path.join(os.getcwd(), key_name + '.pem')

  with open(path_private_key, 'wb') as f:
    f.write(private_key)
  with open(path_public_key, 'wb') as f:
    f.write(public_key)

  logger.info('SSH key pair generated. Public key saved in {0:s}, private key '
              'saved in {1:s}'.format(path_public_key, path_private_key))

  return public_key.decode('utf-8')
Generate a SSH key pair and returns its public key.

Both public and private keys will be saved in the current directory.

Args:
vm_name (str): The VM name for which to generate the key pair.

Returns:
str: The public key for the generated SSH key pair.

Raises:
ValueError: If vm_name is None.
tools/az_cli.py