0

Azure에서 서비스 패브릭 클러스터를 생성하기위한 일련의 스크립트와 템플릿을 빌드하고 있습니다. 키 볼트 및 자체 서명 된 인증서를 만들고이를 볼트에 성공적으로 업로드하는 스크립트가 있습니다. 다른 스크립트는 클러스터를 생성하지만 certs가 VM에 링크되는 시점에 오류가 발생합니다. New-AzureRmResourceGroupDeployment 명령의 오류는 다음과 같습니다 -Azure KeyVaultAccessForbidden - "배포 할 수 없습니다"

{ 
    "status": "Failed", 
    "error": { 
    "code": "ResourceDeploymentFailure", 
    "message": "The resource operation completed with terminal provisioning state 'Failed'.", 
    "details": [ 
    { 
     "code": "KeyVaultAccessForbidden", 
     "message": "Key Vault https://VAULT-NAME.vault.azure.net/secrets/clusterCert/SECRET-ID either has not been enabled for deployment or the vault id provided, /subscriptions/SUBSCRIPTION-ID/resourceGroups/jg-sf/providers/Microsoft.KeyVault/vaults/VAULTNAME, does not match the Key Vault's true resource id." 
    } 
    ] 
} 

}

VAULT-NAME의 가입 ID와 비밀 ID는 모두 정확합니다. 키 저장소는 다음 스크린 샷에서 볼 수 있듯이 "enabledForTemplateDeployment": true 매개 변수로 생성되었습니다.

Key vault config screenshot

내 스크립트와 템플릿은 GitHub의에서 볼 수 있습니다 - https://github.com/goochjs/azure-testbed.

어떻게 문제를 진단합니까?

감사합니다,

제레미.

+0

그 메시지의 두 번째 부분과 관련이 있다고 생각합니다. 템플릿을 공유 할 수 있습니까? SF 클러스터는 resourceId와 uri를 요구하며 정확히 일치해야한다는 점에서 조금 이상합니다. –

+0

답장을 보내 주셔서 감사합니다. 위의 소스 코드에 대한 링크를 추가했습니다 (여기에서 -> https://github.com/goochjs/azure-testbed) –

+0

keyvault와 함께이 템플릿을 배포 할 수 있는지 확인하십시오. 문제의 원인은 다음과 같습니다. https://github.com/Azure/azure-quickstart-templates/tree/master/service-fabric-cluster-ubuntu-5-node-1-nodetype –

답변

2

어떻게 키 볼트를 만드나요? 다음의 스크립트를 사용하여 키 볼트를 생성하고 CertificateURL을 얻습니다.

New-AzureRmKeyVault -VaultName $KeyVaultName -ResourceGroupName $ResourceGroup -Location $Location -sku standard -EnabledForDeployment 

#Creates a new selfsigned cert and exports a pfx cert to a directory on disk 
$NewCert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName $CertDNSName 
Export-PfxCertificate -FilePath $CertFileFullPath -Password $SecurePassword -Cert $NewCert 
Import-PfxCertificate -FilePath $CertFileFullPath -Password $SecurePassword -CertStoreLocation Cert:\LocalMachine\My 

#Reads the content of the certificate and converts it into a json format 
$Bytes = [System.IO.File]::ReadAllBytes($CertFileFullPath) 
$Base64 = [System.Convert]::ToBase64String($Bytes) 

$JSONBlob = @{ 
    data = $Base64 
    dataType = 'pfx' 
    password = $Password 
} | ConvertTo-Json 

$ContentBytes = [System.Text.Encoding]::UTF8.GetBytes($JSONBlob) 
$Content = [System.Convert]::ToBase64String($ContentBytes) 

#Converts the json content a secure string 
$SecretValue = ConvertTo-SecureString -String $Content -AsPlainText -Force 

#Creates a new secret in Azure Key Vault 
$NewSecret = Set-AzureKeyVaultSecret -VaultName $KeyVaultName -Name $KeyVaultSecretName -SecretValue $SecretValue -Verbose 

#Writes out the information you need for creating a secure cluster 
Write-Host 
Write-Host "Resource Id: "$(Get-AzureRmKeyVault -VaultName $KeyVaultName).ResourceId 
Write-Host "Secret URL : "$NewSecret.Id 
Write-Host "Thumbprint : "$NewCert.Thumbprint 

자세한 내용은 blog을 참조하십시오.

Resource Id 형식을 확인할 수 있습니다. 올바른 형식은 /subscriptions/***************/resourceGroups/westus-mykeyvault/providers/Microsoft.KeyVault/vaults/shuisfsvault입니다. 먼저 Azure Portal에서 SF 클러스터를 만들 수 있습니다.

여전히 작동하지 않으면 키 저장소를 확인할 수 있는지, 충분한 권한을 부여합니까?

enter image description here

참고 : 테스트를 위해, 당신은 사용자에게 모든 권한을 부여 할 수있다.

+0

답장을 보내 주셔서 감사합니다. 인증서 및 키 저장소 생성을위한 스크립트가 약간 씩 다르지만 비슷하지만 Windows 7에 기반하여 부분적으로 구동되므로 Windows 10의 모든 인증서 작성 기능을 사용할 수있는 것은 아닙니다. 스크립트와 템플릿을 GitHub에 넣었습니다. -> https://github.com/goochjs/azure-testbed –

+0

열쇠 보관소의 자원 ID 형식이 잘못되었습니다. 코드로 작성 중이었고 경로 내의 잘못된 리소스 그룹을 참조했습니다. 불행히도, 나는 이제 다른 오류 (!)를 얻고 있지만이 문제는 해결되었습니다. –