<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kazuyuki Miyake</title>
    <description>The latest articles on DEV Community by Kazuyuki Miyake (@miyake).</description>
    <link>https://dev.to/miyake</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F203645%2Fcc4878c0-8551-4af5-963b-5b8182f670a4.jpeg</url>
      <title>DEV Community: Kazuyuki Miyake</title>
      <link>https://dev.to/miyake</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/miyake"/>
    <language>en</language>
    <item>
      <title>Azure Cosmos DB Networking options</title>
      <dc:creator>Kazuyuki Miyake</dc:creator>
      <pubDate>Sun, 13 Sep 2020 13:20:01 +0000</pubDate>
      <link>https://dev.to/miyake/azure-cosmos-db-networking-features-1pnm</link>
      <guid>https://dev.to/miyake/azure-cosmos-db-networking-features-1pnm</guid>
      <description>&lt;p&gt;Over the past sevral months or so, enhancements to the Networking options have become more active in the PaaS/Serverless area of Azure. Even for Azure Cosmos DB, which is called serverless DB, &lt;a href="https://azure.microsoft.com/en-us/updates/azure-private-link-for-azure-cosmos-db-is-now-generally-available/" rel="noopener noreferrer"&gt;Private Link For Cosmos DB was generally available&lt;/a&gt; in spring 2020.&lt;/p&gt;

&lt;p&gt;I would like to take this opportunity to summarize the network configuration of Cosmos DB, as we have been using this feature more and more in our real projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three approaches for Cosmos DB Networking
&lt;/h2&gt;

&lt;p&gt;Most Azure PaaS services, not just Cosmos DB, offer three types of network connections,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All networks&lt;/li&gt;
&lt;li&gt;Service endpoints&lt;/li&gt;
&lt;li&gt;Private endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In fact, even with Cosmos DB provisioning, you can choose from three options (even after provisioning)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjhj58rladvmy8teo9ohy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjhj58rladvmy8teo9ohy.png" alt="Cosmos DB provisioning (Networking)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the configuration screen, the expression is slightly different: &lt;code&gt;Public endpoint&lt;/code&gt; is a connection via Service endpoint and &lt;code&gt;Private endpoint&lt;/code&gt; is a connection using Private Link.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service endpoints
&lt;/h2&gt;

&lt;p&gt;Connection to Cosmos DB via Service endpoint is completed by adding a virtual network in the &lt;code&gt;Firewall and virtual networks&lt;/code&gt; menu. When selecting a VNET, you need to specify a subnet to connect to Cosmos DB service endpoint (Public IP endpoint). The configuration may take up to 15 minutes to take effect, so you may have to wait until the &lt;code&gt;Endpoint Status&lt;/code&gt; becomes &lt;code&gt;Enable&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-configure-vnet-service-endpoint" rel="noopener noreferrer"&gt;Configure access from virtual networks (VNet) | Microsoft Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One thing to keep in mind when setting up Service endpoint is that unless the client is participating in the virtual network, you won't be able to use Data Explorer or Azure Storage Explorer to manipulate the data. The easiest solution is to add the client IP address to the Firewall (also configurable in CIDR Range). In addition, you should also check the &lt;code&gt;Allow access from Azure Portal&lt;/code&gt; if you are operating from the Azure Portal.&lt;/p&gt;

&lt;p&gt;With the virtual network and IP firewall configured, it looks like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foeurd18jiz8dgw9avxin.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foeurd18jiz8dgw9avxin.png" alt="Firewall and virtual networks settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Private endpoints
&lt;/h2&gt;

&lt;p&gt;This is the connection via Plivate Link, where a private IP is assigned to the Cosmos DB endpoint, which is easy to use in an environment where you are using ExpressRoute to connect on-premises networks and virtual networks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-configure-private-endpoints" rel="noopener noreferrer"&gt;Configure Azure Private Link for an Azure Cosmos account | Microsoft Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For configuration, go to the &lt;code&gt;Private Endpoint Connections&lt;/code&gt; menu and click on &lt;code&gt;+ Private Endpoint&lt;/code&gt; to configure private endpoints (create a private endpoint, specify a subnet, set a private DNS zone). When the configuration is complete, a Private endpoint resource will be created as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F56pyhv3whdx4zuxfr1xn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F56pyhv3whdx4zuxfr1xn.png" alt="Private Endpoint settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For client environments with Private endpoint, Cosmos DB can be used in conjunction with IP Firewalls. If you have policy constraints, you may need to connect to a virtual network using ExpressRoute or via Azure Bastion.&lt;/p&gt;




&lt;p&gt;In this entry, I have introduced Networking options in Azure Cosmos DB. You can configure Service endpoints and Private endpoints in other Azure PaaS/Serverless services with almost similar settings.&lt;/p&gt;

&lt;p&gt;With more network configuration options in the Azure Paas/Serverless area, not only has there been a wider range of network designs, but also enterprise projects that tend to have strict network policies have been helped by the fact that PaaS networks don't become an issue that stops discussions from moving forward.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>cosmos</category>
    </item>
    <item>
      <title>Create scalable Vue.js application with Azure Static Web Apps</title>
      <dc:creator>Kazuyuki Miyake</dc:creator>
      <pubDate>Tue, 26 May 2020 15:00:15 +0000</pubDate>
      <link>https://dev.to/miyake/create-scalable-vue-js-application-with-azure-static-web-apps-12np</link>
      <guid>https://dev.to/miyake/create-scalable-vue-js-application-with-azure-static-web-apps-12np</guid>
      <description>&lt;p&gt;Have you joined Microsoft Build 2020, where Microsoft introduced various exciting news to the world? Among all of the updates, I am especially keen to introduce &lt;a href="https://docs.microsoft.com/en-us/azure/static-web-apps/overview"&gt;Azure Static Web Apps&lt;/a&gt;, the hosting service for static website which has been finally announced as Public Preview, and that enables us to create &amp;amp; deploy &lt;a href="https://vuejs.org/"&gt;Vue.js&lt;/a&gt; Web application literally within "a few minutes".&lt;/p&gt;

&lt;p&gt;Vue.js is made based on the concept of "Progressive Framework", hence we can start writing from very small, and gradually grow them into the enterprise &lt;br&gt;
 scale. In this post, I would like to introduce the first step to create scalable application using Vue.js and Azure Static Web Apps.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating new project with Vue CLI
&lt;/h2&gt;

&lt;p&gt;In order to be ready to use Azure Static Web Apps, your application code needs to be on GitHub. First, write some basic code. A shortcut to create Vue.js project is to use &lt;a href="https://cli.vuejs.org/"&gt;Vue CLI&lt;/a&gt;. For example, with Vue CLI, you can configure Router, or TypeScript in the appropriate way.&lt;/p&gt;

&lt;p&gt;Let’s get started. Using Terminal, move to directory where the application will be created to run the command like below,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @vue/cli
vue create &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create the project with frequently-used configuration with Vue CLI prompt. I choose TypeScript here because I believe TypeScript is going to be  major in Vue.js project. Also, select Router, ESLint, Prettier and Jest which is majorly used in many projects. For "Use class-style component syntax?", I suggest to select "No" since it is not longer mainstream with Vue.3x.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Vue CLI v4.3.1
? Please pick a preset: Manually &lt;span class="k"&gt;select &lt;/span&gt;features
? Check the features needed &lt;span class="k"&gt;for &lt;/span&gt;your project: TS, Router, Linter, Unit
? Use class-style component syntax? No
? Use Babel alongside TypeScript &lt;span class="o"&gt;(&lt;/span&gt;required &lt;span class="k"&gt;for &lt;/span&gt;modern mode, auto-detected polyfills, transpiling JSX&lt;span class="o"&gt;)&lt;/span&gt;? No
? Use &lt;span class="nb"&gt;history &lt;/span&gt;mode &lt;span class="k"&gt;for &lt;/span&gt;router? &lt;span class="o"&gt;(&lt;/span&gt;Requires proper server setup &lt;span class="k"&gt;for &lt;/span&gt;index fallback &lt;span class="k"&gt;in &lt;/span&gt;production&lt;span class="o"&gt;)&lt;/span&gt; Yes
? Pick a linter / formatter config: Prettier
? Pick additional lint features: Lint on save   
? Pick a unit testing solution: Jest
? Where &lt;span class="k"&gt;do &lt;/span&gt;you prefer placing config &lt;span class="k"&gt;for &lt;/span&gt;Babel, ESLint, etc.? In dedicated config files
? Save this as a preset &lt;span class="k"&gt;for &lt;/span&gt;future projects? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; N
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a while, Vue.js project will be generated. Let’s check if application runs properly on local.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the green Vue.js logo on the initial screen shows up, the basic configuration is all set up. You can already run not only TypeScript compile but also unit testing and formatting. The rest is just to add the code for features of the your application!&lt;/p&gt;

&lt;p&gt;At this point, push codes to GitHub in order to get ready for the deploy to Azure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Provisioning Azure Static Web Apps
&lt;/h2&gt;

&lt;p&gt;Open Azure portal and go to "Create a resource", and search "static web apps". Fill in all the necessary information as follow. In this process, you link this resource with the GitHub Repo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wNuDm1xF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4o9ov1vkjhk0oqiocypi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wNuDm1xF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4o9ov1vkjhk0oqiocypi.png" alt="Create a resource" width="880" height="899"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click "Next:Build", and it takes you to the next step. In this step, type "dist" for "App artifact location". "dist" is a directory which outputs the static files for hosting , such as HTML,CSS, Javascript when we run &lt;code&gt;npm run build&lt;/code&gt; (standard build command of Vue CLI) .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ClEuQpCi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qcqch39xudunrfqquql5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ClEuQpCi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qcqch39xudunrfqquql5.png" alt="Build" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click "Review + Create"and and wait a few minutes, deployment is complete! You don’t need to configure CI service or write the build script in YAML.&lt;/p&gt;

&lt;p&gt;At this point, build workflow of GitHub Actions runs automatically in the background. To check the build status, you can open Actions tab in GitHub. If the Icon is green, then the build and deploy is successfully completed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r-8Wpswh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h44nun3u1aqm3ntgnzfh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r-8Wpswh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h44nun3u1aqm3ntgnzfh.png" alt="GitHub Actions" width="880" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s go back to the Azure portal and click the site URL. You will see the same page published as the application you ran locally. &lt;/p&gt;

&lt;p&gt;At this moment, YAML file is already added to &lt;code&gt;.github/workflows&lt;/code&gt; in GitHub repository, so do not forget to pull them to local.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting fallback routes
&lt;/h2&gt;

&lt;p&gt;We selected "History Mode" when we set up Router with Vue CLI. In the SPA, re-loading a specific page cause 404 if we do not configure anything on the hosting environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2bFLZsHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uhqq0p5626u2sut6phrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2bFLZsHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uhqq0p5626u2sut6phrj.png" alt="404" width="880" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable History Mode in a hosting environment, you need to make the appropriate setting for the environment. In case of hosting Vue.js on Azure Static Web Apps, create &lt;code&gt;routes.json&lt;/code&gt; file under &lt;code&gt;public&lt;/code&gt; directory like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"routes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"route"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"serve"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/index.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"statusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, let’s push this change to brunch and create pull request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_BLeDA2K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fn9uo1eiwtz12er1oedb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_BLeDA2K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fn9uo1eiwtz12er1oedb.png" alt="Pull Request" width="880" height="733"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, The pull request is triggered and the deployment to Static Web Apps is executed. Once build process is completed, you can confirm the deployed change under "Environments" in Azure Portal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ckVhJSz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5v2pv3nlc0hv9h9p3oa9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ckVhJSz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5v2pv3nlc0hv9h9p3oa9.png" alt="Staging" width="880" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s check "about" page which we had problem with earlier. Now, it no longer shows 404 page after reloading.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lonnj2Ej--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqkryqs9scj1xljig0e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lonnj2Ej--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqkryqs9scj1xljig0e1.png" alt="200" width="880" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All you have to do for the rest is just to merge pull request and wait for it being deployed to "production" environment. When pull request is closed, staging environment will be automatically deleted.&lt;/p&gt;

&lt;p&gt;I hope you experienced how easy it is to host scalable Vue.js application with Azure. Azure Static Web Apps is currently available to Public Preview, for free! Who wouldn’t try it?&lt;/p&gt;

</description>
      <category>vue</category>
      <category>azure</category>
      <category>staticwebapps</category>
    </item>
  </channel>
</rss>
