{"id":3989,"date":"2024-06-13T17:59:39","date_gmt":"2024-06-13T17:59:39","guid":{"rendered":"https:\/\/www.thesslstore.com\/knowledgebase\/?post_type=ht_kb&#038;p=3989"},"modified":"2024-06-13T17:59:42","modified_gmt":"2024-06-13T17:59:42","slug":"azure-key-vault-code-signing-instructions","status":"publish","type":"ht_kb","link":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/","title":{"rendered":"Azure Key Vault Code Signing Instructions\u00a0"},"content":{"rendered":"\n<p>Follow these instructions to store a code signing certificate and private key in Azure Key Vault. This allows you to store your signing key securely (complying with current industry standards) without needing a USB token or your own hardware security module (HSM).<\/p>\n<h1>Part 1: Issue a Code Signing Certificate to Azure Key Vault<\/h1>\n<h2>Create an Azure Key Vault<\/h2>\n<p>In the Microsoft Azure Portal, open \u201cKey vaults\u201d then click Create.<\/p>\n<p>Enter in the required details, being sure to select \u201cPremium\u201d pricing tier. This is necessary to enable HSM-storage for your private keys. Without HSM storage, your private key will not be stored in a compliant manner and your certificate may be revoked.<\/p>\n<p>Note: You do not need to setup Azure Key Vault Managed HSM, just a standard key vault will suffice.<\/p>\n<p>Copy down your Vault URI, you\u2019ll need it later.<\/p>\n<h2>Assign Key Vault Permissions<\/h2>\n<p>After creating the Key Vault, you\u2019ll have \u201cOwner\u201d permissions. You\u2019ll need to also assign yourself the role \u201cKey Vault Administrator\u201d.<\/p>\n<p>You can do this by clicking on Access control (IAM), then on \u201cAdd role assignment\u201d.<\/p>\n<h2>Purchase a DigiCert Code Signing Certificate<\/h2>\n<p>Only DigiCert code signing certificates are compatible with Azure Key Vault. Sectigo\/Comodo code signing certificates require key attestation, which Azure Key Vault does not support.<\/p>\n<h2>Create Certificate Signing Request (CSR)<\/h2>\n<p>Inside your new Azure Key Vault, go to Objects &gt; Certificates, then \u201cGenerate\/Import\u201d. Fill out the form with these values:<\/p>\n<ul>\n<li>Method of Certificate Creation: Generate<\/li>\n<li>Type of Certificate Authority (CA): Certificate issued by a non-integrated CA<\/li>\n<li>Subject: CN=My Organization Name\n<ul>\n<li>Do not include a comma (don\u2019t worry, this doesn\u2019t have to exactly match what will be displayed on the certificate, DigiCert only uses the public key from your CSR and ignores the other fields)<\/li>\n<\/ul>\n<\/li>\n<li>DNS Names: 0<\/li>\n<li>Content Type: PKCS #12<\/li>\n<\/ul>\n<p>Next, click to configure Advanced Policy Configuration and enter these options:<\/p>\n<ul>\n<li>In the EKU field, add this EKU to the list: 1.3.6.1.5.5.7.3.3<\/li>\n<li>Exportable Private Key: No<\/li>\n<li>Key Type: RSA-HSM (or EC-HSM)\n<ul>\n<li>It\u2019s very important to choose a key type that ends in HSM. If you choose a non-HSM key-type, your key will not be stored in a compliant manner and your certificate could be revoked.<\/li>\n<\/ul>\n<\/li>\n<li>Key Size: 3072<\/li>\n<\/ul>\n<p>After clicking create, your newly created certificate request will be listed under \u201cIn progress, failed or cancelled\u201d. Click on the certificate name, then on Certificate Operation, then on Download CSR.<\/p>\n<h2>Submit CSR &amp; Complete Validation<\/h2>\n<p>Follow the instructions provided by your certificate provider to submit the CSR to the certificate authority.<\/p>\n<p>As part of the validation process, DigiCert will send you an email with a form to verify that you are storing the keys in a compliant location. Fill out this form (and any other forms required for validation), then wait for the certificate to be issued.<\/p>\n<p>Note: this is why it was critical that you select HSM storage when creating the certificate in Azure Key Vault. If you didn\u2019t select HSM storage, your certificate could be revoked for non-compliant key storage.<\/p>\n<h2>Merge Certificate<\/h2>\n<p>After DigiCert issues your certificate:<\/p>\n<p>Go back into Azure Key Vault and open up the certificate. Click on Certificate Operation, then on Merge Signed Request.<\/p>\n<p>Open the .zip folder that DigiCert sent you with the certificate. Look for the file with your name or company name as the file name (eg acme_llc.crt). Open the file in a text editor. Copy the certificate text, paste it into Azure Key Vault, and complete the merge. Your certificate has now been merged with the private key and is ready to use.<\/p>\n<h1>Part 2: Sign Code with a Certificate in Azure Key Vault<\/h1>\n<p>You\u2019re now ready to sign code using your code signing certificate stored in Azure Key Vault. The specific steps will vary depending on the context you\u2019re doing code signing in, but we\u2019ll walk you through how to do it using AzureSignTool on a Windows desktop.<\/p>\n<h2>Install AzureSignTool<\/h2>\n<p>One popular tool is AzureSignTool, an open source version of SignTool modified to work with Azure Key Vault: https:\/\/github.com\/vcsjones\/AzureSignTool<\/p>\n<p>Be sure you have the latest version of the .NET SDK installed, then open up Command Prompt and run: dotnet tool install &#8211;global AzureSignTool<\/p>\n<h2>Setup an Azure Entra ID Application<\/h2>\n<p>https:\/\/learn.microsoft.com\/en-us\/entra\/identity-platform\/quickstart-register-app (don\u2019t worry about the redirect URL).<\/p>\n<p>Copy down your:<\/p>\n<ul>\n<li>Tenant ID<\/li>\n<li>Application (client ID)<\/li>\n<\/ul>\n<p>After creating the app: In the navigation menu for the app, go to Certificates &amp; secrets, then Client secrets. Click New client secret and create a new secret. Be sure to immediately copy down the displayed \u201cValue\u201d: you won\u2019t be able to see it again.<\/p>\n<h2>Grant the Application Access to the Key Vault<\/h2>\n<p>Open your Key Vault, then go to Access control (IAM). Click on \u201cAdd role assignment\u201d. Choose a role with sufficient permissions (eg. Key Vault Crypto User) and grant access to your newly created Entra ID application.<\/p>\n<h2>Sign Your Executable<\/h2>\n<p>Run this command to sign a file in your pesent working directory:<\/p>\n<p><code>azuresigntool sign -kvu [vault uri] -kvc [certificate name] -kvi [application id] -kvs [secret] -kvt [tenant id] -tr http:\/\/timestamp.digicert.com -v [filename.exe]<\/code><\/p>\n<p>(Replace the placeholders, including brackets, with your actual values.)<\/p>\n<p>Fields:<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 138px;\">\n<tbody>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">kvu<\/td>\n<td style=\"width: 50%; height: 23px;\">Your Key Vault\u2019s Vault URI<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">kvc<\/td>\n<td style=\"width: 50%; height: 23px;\">Your certificate\u2019s name in Key Vault<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">kvi<\/td>\n<td style=\"width: 50%; height: 23px;\">The Entra application ID<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">kvs<\/td>\n<td style=\"width: 50%; height: 23px;\">The Entra application secret<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">kvt<\/td>\n<td style=\"width: 50%; height: 23px;\">Your Entra ID tenant ID<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 50%; height: 23px;\">tr<\/td>\n<td style=\"width: 50%; height: 23px;\">Timestamp URL, i.e. http:\/\/timestamp.digicert.com<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Follow these instructions to store a code signing certificate and private key in Azure Key Vault. This allows you to store your signing key securely (complying with current industry standards) without needing a USB token or your own hardware security module (HSM). Part 1: Issue a Code Signing Certificate to&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[29],"ht-kb-tag":[],"class_list":["post-3989","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-code-signing-sign-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Azure Key Vault Code Signing Instructions\u00a0 - Knowledge Base<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Azure Key Vault Code Signing Instructions\u00a0 - Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"Follow these instructions to store a code signing certificate and private key in Azure Key Vault. This allows you to store your signing key securely (complying with current industry standards) without needing a USB token or your own hardware security module (HSM). Part 1: Issue a Code Signing Certificate to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/thesslstoredotcom\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-13T17:59:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.thesslstore.com\/knowledgebase\/wp-content\/uploads\/2017\/04\/thesslstore.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@thesslstore\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Azure Key Vault Code Signing Instructions\u00a0 - Knowledge Base","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/","og_locale":"en_US","og_type":"article","og_title":"Azure Key Vault Code Signing Instructions\u00a0 - Knowledge Base","og_description":"Follow these instructions to store a code signing certificate and private key in Azure Key Vault. This allows you to store your signing key securely (complying with current industry standards) without needing a USB token or your own hardware security module (HSM). Part 1: Issue a Code Signing Certificate to...","og_url":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/","og_site_name":"Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/thesslstoredotcom","article_modified_time":"2024-06-13T17:59:42+00:00","og_image":[{"width":300,"height":300,"url":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-content\/uploads\/2017\/04\/thesslstore.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@thesslstore","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/","url":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/","name":"Azure Key Vault Code Signing Instructions\u00a0 - Knowledge Base","isPartOf":{"@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#website"},"datePublished":"2024-06-13T17:59:39+00:00","dateModified":"2024-06-13T17:59:42+00:00","breadcrumb":{"@id":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.thesslstore.com\/knowledgebase\/code-signing-sign-code\/azure-key-vault-code-signing-instructions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.thesslstore.com\/knowledgebase\/"},{"@type":"ListItem","position":2,"name":"Azure Key Vault Code Signing Instructions\u00a0"}]},{"@type":"WebSite","@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#website","url":"https:\/\/www.thesslstore.com\/knowledgebase\/","name":"Knowledge Base","description":"TheSSLstore","publisher":{"@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.thesslstore.com\/knowledgebase\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#organization","name":"The SSL Store\u2122","url":"https:\/\/www.thesslstore.com\/knowledgebase\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#\/schema\/logo\/image\/","url":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-content\/uploads\/2017\/04\/thesslstore.jpg","contentUrl":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-content\/uploads\/2017\/04\/thesslstore.jpg","width":300,"height":300,"caption":"The SSL Store\u2122"},"image":{"@id":"https:\/\/www.thesslstore.com\/knowledgebase\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/thesslstoredotcom","https:\/\/x.com\/thesslstore","https:\/\/www.linkedin.com\/company\/the-ssl-store","https:\/\/www.youtube.com\/user\/thesslstore"]}]}},"_links":{"self":[{"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/3989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=3989"}],"version-history":[{"count":0,"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/3989\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=3989"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-category?post=3989"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.thesslstore.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-tag?post=3989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}