簡體   English   中英

如何在Azure上使用ssh證書部署Linux VM

[英]How to deploy a Linux VM using ssh-certification on Azure

當我使用無密碼選項“ -P”創建新的vm linux並添加.pem文件的路徑時,我遇到了Windows azure命令行界面的問題,如下所示

$ azure vm create myapimachine1 b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_2-LTS-amd64-server-20130325-en-us-30GB ahmed --location "West US" --ssh 22 -t /media/ahmed/1578-4B0E/WindowsAzure/AzureCert/mycert.pem -P  

Azure要求我插入.pfx類型而不是pem的證書:

info:    Executing command vm create
+ Looking up image                                                             
+ Looking up cloud service                                                     
warn:    --location option will be ignored
+ Getting cloud service properties                                             
+ Looking up deployment                                                        
+ Retrieving storage accounts                                                  
-error:   The certificate file is invalid. The certificate file must be a Base64-encoded .pfx file.
info:    Error information has been recorded to azure.err
error:   vm create command failed

當我使用.pfx證書運行相同的命令時,如下所示:

$ azure vm create myapimachine1 b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_2-LTS-amd64-server-20130325-en-us-30GB ahmed --location "West US" --ssh 22 -t /media/ahmed/1578-4B0E/WindowsAzure/AzureCert/mycert.pfx -P

Azure命令行要求我以.pem格式添加ssh證書:

nfo:    Executing command vm create
+ Looking up image                                                             
+ Looking up cloud service                                                     
warn:    --location option will be ignored
+ Getting cloud service properties                                             
+ Looking up deployment                                                        
+ Retrieving storage accounts                                                  
error:   Specified SSH certificate is not in PEM format
info:    Error information has been recorded to azure.err
error:   vm create command failed

注意:此過程在Windows Azure門戶上正常運行,但是我在python的REST API和Azure的CLI中遇到此問題

謝謝

艾哈邁德·阿卜杜拉(Ahmed Abdullah)

我也遇到了這個問題(azure cli v0.8.11)

在查看源代碼時,該工具正在尋找一個以

-----BEGIN CERTIFICATE-----並以-----END CERTIFICATE-----結尾。

(摘自:lib / util / utils.js:34-35,252-254&lib / node_modules / azure_cli / vmclient.js:3448)

我懷疑看看/media/ahmed/1578-4B0E/WindowsAzure/AzureCert/mycert.pem會發現

-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----

就像我的存在和終結標記。

我在這里找到了一個解決方案,該解決方案說明了問題所在,並提供了一篇文章的鏈接, 該文章介紹了如何解決該問題。

(如果您趕時間,請使用命令的輸出:

openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out myCert.pem

而不是裸鍵)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM