On Azure, public key in new VM is broken

I created an Azure VM from Rocky a couple of times.
I told Azure to use my usual existing ssh key.

I am unable to log in with the ssh key.
I login with the serial console, with cat:

[eyeadmin@Rocky-8-2 ~]$ cat .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCmzAqw9WsJwNqckmkVOsAq5uMA b8peb0XZsk+BfPNg+JXJtkMtpmgEC5yFek1KEVErr52W2YDUvLbtzmUxdBEZ8nC3
… several lines removed here …
Zy81zSCEzpmVuEbA8A+Waj8JuWaEGHX+H8dESXU= generated-by-azure

[eyeadmin@Rocky-8-2 ~]$ cat /etc/rocky-release
Rocky Linux release 8.6 (Green Obsidian)

As you can see, “something” has wrapped the public key over multiple lines. And added “generated-by-azure”

I edited the authorized_keys file, and removed all the white space so the key is in one line as required.
After that I was able to login with my ssh key.
This shows that Azure provided my correct public key when the VM was being created.
I think it looks like the startup processing scripts provided to Azure with the Rocky OS is wrapping the key, possibly at 80 characters.

I posted this in a an existing thread about Azure. I should have posted it separately, so I am doing that now.

hi! thank you for the report. i’ve opened a bug report here to track this.

https://bugs.rockylinux.org/view.php?id=126

Thanks,
Neil