0

Azureでサービスファブリッククラスタを作成するための一連のスクリプトとテンプレートを作成しています。キーボルトと自己署名証明書を作成し、それをボールトに正常にアップロードするスクリプトがあります。別のスクリプトがクラスタを作成しますが、証明書が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で作成されています。 https://github.com/goochjs/azure-testbed - 私のスクリプトとテンプレートがGitHubの中で見ることができます

Key vault config screenshot

問題を診断するにはどうすればよいですか?

ありがとう、

Jeremy。

+0

メッセージの2番目の部分と関係があると思われます。テンプレートを共有できますか? 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の形式が間違っていました。私はコードでそれを構築していて、パス内の間違ったリソースグループを参照していました。残念ながら、別のエラー(!)が表示されていますが、この問題は解決されています。 –

関連する問題