【问题标题】:Azure certificate assign to vmAzure 证书分配给 vm
【发布时间】:2018-01-16 12:44:58
【问题描述】:

我正在尝试在 VM 机器上添加存储在 Key Vault 中的证书,但我做不到,有人知道该怎么做吗?

我希望你帮我解决这个问题。

【问题讨论】:

    标签: azure ssl iis https


    【解决方案1】:

    # Install a secret stored in KeyVault into an Azure VM's credential store.
    $resourceGroup = [resource group name]
    $vm = Get-AzureRmVM -ResourceGroupName $resourceGroup -Name [VM name]
    $vaultId = "/subscriptions/[subscription guid]/resourceGroups/$resourceGroup/providers/Microsoft.KeyVault/vaults/[vault name]"
    $certStore = "My"
    $certUrl = [KeyVault secret URL w/ version id]
    $vm = Add-AzureRmVMSecret -VM $vm -SourceVaultId $vaultId -CertificateStore $certStore -CertificateUrl $certUrl
    
    # Update the VM so the changes take effect.
    Update-AzureRmVM -ResourceGroupName $resourceGroup -VM $vm

    server {
        listen 80;
        return 301 https://$host$request_uri;
    }
    
    server {
    
        listen 443;
        server_name tokensaletest.southcentralus.cloudapp.azure.com;
    
        ssl_certificate           /etc/nginx/ssl/cert.pem;
        ssl_certificate_key       /etc/nginx/ssl/key.key;
    
        ssl on;
        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;
    
        access_log            /var/log/nginx/jenkins.access.log;
    
        location / {
    
          proxy_set_header        Host $host;
          proxy_set_header        X-Real-IP $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Forwarded-Proto $scheme;
    
          # Fix the “It appears that your reverse proxy set up is broken" error.
          proxy_pass          http://localhost:8000;
          proxy_read_timeout  90;
    
          proxy_redirect      http://localhost:8000 https://tokensaletest.southcentralus.cloudapp.azure.com;
        }
      }

    更多信息请参考article 部署Certificates to VMs from customer-managed Key Vault

    补充资料:Configure App Service Certificate to Azure Virtual machine with Windows or Linux OS

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      • 2021-02-27
      • 2017-06-25
      • 2019-05-25
      • 2023-04-06
      • 2021-12-23
      相关资源
      最近更新 更多