<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Eric Jarvi</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ejarvi/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ejarvi/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 05:04:49 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Encrypting Data Disks on Linux with Azure Disk Encryption</title>
      <link>https://docs.microsoft.com/archive/blogs/ejarvi/encrypting-data-disks-on-linux-with-azure-disk-encryption</link>
      <pubDate>Fri, 30 Mar 2018 14:42:44 GMT</pubDate>
      <dc:creator><![CDATA[ejarvi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ejarvi/?p=2655</guid>
      <description><![CDATA[There are two main ways to encrypt data disks using Azure Disk Encryption.  You can choose to...]]></description>
      <content:encoded><![CDATA[<p class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">There are two main ways to encrypt data disks using Azure Disk Encryption.  You can choose to thoroughly encrypt the existing disk block-by-block using EnableEncryption, or you can choose to rapidly format and encrypt the data disk using EncryptFormatAll.</p>
<p class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">Both of these techniques have a common setup requirement that will signal to the ADE solution which data disks are to be encrypted:</p>

<h2>Prerequisite Data Disk Setup​</h2>
<blockquote>
<p class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">First, prior to enabling encryption, the data disks to be encrypted need to be properly listed in /etc/fstab. Take care to use a persistent block device name for this entry, as device names in the "/dev/sdX" format cannot be relied to be associated with the same disk across reboots particularly after encryption is applied. For more detail on this behavior, see:  <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/linux/troubleshoot-device-names-problems">https://docs.microsoft.com/en-us/azure/virtual-machines/linux/troubleshoot-device-names-problems</a></p>
&nbsp;

Next, ensure that the /etc/fstab settings are configured properly for mounting.  To do this, run the <strong>mount -a</strong> command or reboot the VM and trigger the remount that way.  Once that is complete, check the output of the <strong>lsblk </strong>command to verify that the desired drive is still mounted.  The reason for this test is simple. If the /etc/fstab file does not mount the drive properly prior to enabling encryption, ADE will not able to mount it properly either.  The ADE process will be moving the mount information <em>out of </em>/etc/fstab and into its own configuration file as part of the encryption process.  Do not be surprised to see the entry missing from /etc/fstab after data drive encryption completes.  Also be sure to give time after reboot for the ADE process to mount the newly encrypted disks.  They will not be immediately available after a reboot, the ADE process will need time to start, unlock, and then mount the encrypted drives prior to their being available for other processes to access.  This may take more than a minute after reboot depending on the system characteristics.

&nbsp;
<p class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">​A simple example of commands that can be used to mount the data disks and create the necessary /etc/fstab entries can be found here:</p>
<p class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE"><a href="https://github.com/ejarvi/ade-cli-getting-started/blob/master/validate.sh#L240-L248">https://github.com/ejarvi/ade-cli-getting-started/blob/master/validate.sh#L197-L205</a><a>
</a></p>
&nbsp;
<div class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">Once the data disk is ready, you can choose to either encrypt the existing data block-by-block using EnableEncryption, or you can choose to rapidly format and encrypt the data disks using EncryptFormatAll.</div></blockquote>
<h2 class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">EnableEncryption (encrypt data drive contents, preserving content)</h2>
<blockquote class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">
<div>This process can be very time consuming depending on the size of the drive contents to encrypt, but it allows existing content to be encrypted.</div>
<h3>Powershell:</h3>
<div>To use this process, prepare the drive as above and then use the Powershell cmdlet Set-AzureRmVmDiskEncryptionExtension:</div>
<div>https://docs.microsoft.com/en-us/powershell/module/azurerm.compute/set-azurermvmdiskencryptionextension?view=azurermps-5.4.0</div>
<div></div>
<div></div>
<div>Encryption may take several hours if the "OS" or "All" VolumeType is selected.  If the "Data" VolumeType is selected then the time required will be proportional to the size of the data volume(s) to be encrypted.</div>
<h3>CLI:</h3>
<div>Prepare the drive as above, and then use the <a href="https://docs.microsoft.com/en-us/cli/azure/vm/encryption?view=azure-cli-latest#az_vm_encryption_enable"><strong>az vm encryption enable</strong></a> command.</div>
<div></div>
<div></div>
<div>An example bash script of how to enable encryption end to end that uses this command is available here: <a href="https://github.com/ejarvi/ade-cli-getting-started/blob/master/validate.sh">https://github.com/ejarvi/ade-cli-getting-started/blob/master/validate.sh</a></div>
<div>Please note that on successful completion of this script, the script will automatically delete the resources that it just created.  If you would like to preserve the resource, make sure to comment out or remove the last line of the script prior to running.</div>
<div>
<h3>ARM Template:</h3>
Using an ARM template to encrypt a running Linux VM is possible.  Ensure the EncryptionOperation value is set to "EnableEncryption” - I don't have a pointer to a template that uses this yet, but for now modifying this template may be sufficient:

&nbsp;

</div>
<div><a href="https://github.com/vermashi/azure-quickstart-templates/tree/encrypt-format-running-linux-vm/201-encrypt-running-linux-vm">https://github.com/vermashi/azure-quickstart-templates/tree/encrypt-format-running-linux-vm/201-encrypt-running-linux-vm​</a></div></blockquote>
<h2 class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">EncryptFormatAll</h2>
<blockquote class="ExternalClass5A2BC94EF8ED472E8F0C0176543160AE">
<div>This process is very fast but is only for scenarios where there is no existing content on the mounted data drives.</div>
<div></div>
<div></div>
<div>After running this command any drives that were mounted previously will be formatted and then the encryption layer will be started on top of that now empty drive.</div>
<div></div>
<div></div>
<div>Additionally, when this option is selected, the "ephemeral" resource disk attached to the VM will also be encrypted.  If the ephemeral drive is reset, it will be reformatted and re-encrypted by the ADE solution in the VM at the next opportunity.</div>
<div></div>
<div></div>
<div>Some additional documentation of the EncryptFormatAll mode including powershell and ARM template examples is available at:</div>
<div></div>
<div></div>
<div><a href="https://blogs.msdn.microsoft.com/azuresecurity/2017/11/30/azure-disk-encryption-with-encryptformatall-feature-for-data-disks-on-linux-iaas-vm/">https://blogs.msdn.microsoft.com/azuresecurity/2017/11/30/azure-disk-encryption-with-encryptformatall-feature-for-data-disks-on-linux-iaas-vm/</a></div></blockquote>]]></content:encoded>
    </item>
    <item>
      <title>How to Check Your Azure Management Tools Version</title>
      <link>https://docs.microsoft.com/archive/blogs/ejarvi/how-to-check-your-azure-management-tools-version</link>
      <pubDate>Wed, 28 Mar 2018 14:57:43 GMT</pubDate>
      <dc:creator><![CDATA[ejarvi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ejarvi/?p=2645</guid>
      <description><![CDATA[Both Azure Powershell SDK and Azure CLI 2.0 are frequently updated to stay current.  Older versions...]]></description>
      <content:encoded><![CDATA[<p class="ExternalClass3FE91A182F4A48CCB57C2E053B940967">Both Azure Powershell SDK and Azure CLI 2.0 are frequently updated to stay current.  Older versions have limited shelf life.</p>
<p class="ExternalClass3FE91A182F4A48CCB57C2E053B940967">If a certain Azure management scenario isn't working as expected, it may be because of stale tools. Here are commands to check the version of the tools you may currently have installed:</p>
<p class="ExternalClass3FE91A182F4A48CCB57C2E053B940967"><em>Azure Powershell:</em></p>

<blockquote class="ExternalClass3FE91A182F4A48CCB57C2E053B940967">Get-Module -ListAvailable -Name Azure -Refresh</blockquote>
<p class="ExternalClass3FE91A182F4A48CCB57C2E053B940967"><span>Azure CLI 2.0: </span></p>

<blockquote class="ExternalClass3FE91A182F4A48CCB57C2E053B940967">az --version​</blockquote>
<p class="ExternalClassEF601A6D77DE4D33BF7F3C5BF270BB5A" dir="ltr">The version number corresponding to the most recent release for each of these projects is documented in the Github release history:</p>

<div class="ExternalClassEF601A6D77DE4D33BF7F3C5BF270BB5A">
<ul>
 	<li>
<div class="ExternalClass3FE91A182F4A48CCB57C2E053B940967"><a href="https://github.com/Azure/azure-powershell/releases">https://github.com/Azure/azure-powershell/releases</a></div></li>
 	<li>
<div class="ExternalClass3FE91A182F4A48CCB57C2E053B940967"><a href="https://github.com/Azure/azure-cli/releases">https://github.com/Azure/azure-cli/releases​</a></div></li>
</ul>
</div>
<div class="ExternalClass3FE91A182F4A48CCB57C2E053B940967">​If keeping the installed version of these tools up to date is an annoyance, I would suggest checking out Azure Cloud Shell as a possible alternative.   The Cloud Shell feature is maintained by Azure Portal and tracks to the most recent version of Powershell or CLI automatically.  Doesn't require you to install Powershell or CLI locally on your machine.  You access it through the browser, but it feels pretty close to what you'd get from a local shell. More details at:    <a href="https://azure.microsoft.com/en-us/features/cloud-shell/">https://azure.microsoft.com/en-us/features/cloud-shell/ </a></div>]]></content:encoded>
    </item>
    <item>
      <title>generating self-signed certificates with keyvault</title>
      <link>https://docs.microsoft.com/archive/blogs/ejarvi/generating-self-signed-certificates-with-keyvault</link>
      <pubDate>Tue, 10 Jan 2017 17:23:19 GMT</pubDate>
      <dc:creator><![CDATA[ejarvi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ejarvi/?p=2575</guid>
      <description><![CDATA[Thankfully it is very easy to import pre-existing self-signed certificates into KeyVault.  But......]]></description>
      <content:encoded><![CDATA[Thankfully it is very easy to import <em>pre-existing</em> self-signed certificates into KeyVault.  But... what if you don't have a pre-existing self-signed certificate?

It is possible to have KeyVault generate the new self-signed certificate for you inside of your KeyVault.  One and done.  No import. No messy certificate residue left behind at your admin console.

<strong>The trick to getting KeyVault to do this for you is to use "Self" as the issuer name in your policy file. </strong>

Here is a simple example of how to generate the self-signed certificate using the Azure CLI:
<pre>azure keyvault certificate policy create --issuer-name Self --subject-name "CN=www.contoso.com" --file policy.json --validity-in-months 12
azure keyvault certificate create --vault-name mykeyvault --certificate-name mycert --certificate-policy-file policy.json
</pre>
Here is an example of how to do it using Powershell (as found in the Quick Start document below):
<pre>$policy = New-AzureKeyVaultCertificatePolicy -SubjectName "CN=www.contoso.com" -IssuerName Self -ValidityInMonths 12
Add-AzureKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy
</pre>
If you want to dive deeper, or if what you really want is a full fledged SSL certificate created in similar fashion, here is some more documentation:
<ul>
 	<li>Overview: <a href="https://docs.microsoft.com/en-us/rest/api/keyvault/certificate-scenarios">https://docs.microsoft.com/en-us/rest/api/keyvault/certificate-scenarios</a></li>
 	<li>Quick start: <a href="https://blogs.technet.microsoft.com/kv/2016/09/26/get-started-with-azure-key-vault-certificates/">https://blogs.technet.microsoft.com/kv/2016/09/26/get-started-with-azure-key-vault-certificates/</a></li>
</ul>]]></content:encoded>
    </item>
  </channel>
</rss>