<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by alfred lim on Medium]]></title>
        <description><![CDATA[Stories by alfred lim on Medium]]></description>
        <link>https://medium.com/@alfred_lim?source=rss-b29871d01b96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Cg6O4WzpkoYSE74o.jpg</url>
            <title>Stories by alfred lim on Medium</title>
            <link>https://medium.com/@alfred_lim?source=rss-b29871d01b96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:40:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alfred_lim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Azure series : Azure storage account — SAS token and stored access policy]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-azure-storage-account-sas-token-and-stored-access-policy-b21e96e6bda0?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/b21e96e6bda0</guid>
            <category><![CDATA[account]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[keys]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[storage]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Fri, 25 Oct 2019 07:21:45 GMT</pubDate>
            <atom:updated>2019-10-25T07:21:45.458Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : Azure storage account — SAS token and stored access policy</h3><p>SAS (shared access signature) are URI with temporary key which is signed by account key, to give access/privilege to storage account resources.</p><p>Azure SA only have 2 account keys, and these keys are like “root” super user account if in linux context, so dont share it.</p><p>However, SAS token above is not manageable after you create it.</p><p>If you want to create a SAS token which manageable then you need to use SAS token based on stored access policies. You can modify this policy parameter (eg allowed time to access, allowed IP addresses, CRUD, etc), and that SAS token will comply to it (within 30 seconds). However, this SAS (linked with stored access policy) can not be created via portal, it may be done via Powershell. Altough you can create/alter stored access policy in azure portal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b21e96e6bda0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series : Snapshot a managed disk via API (an alternative for backing up disk image of 32-bit…]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-snapshot-a-managed-disk-via-api-an-alternative-for-backing-up-disk-image-of-32-bit-3932971bab90?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/3932971bab90</guid>
            <category><![CDATA[di̇sk]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[snapshot]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Mon, 21 Oct 2019 02:33:46 GMT</pubDate>
            <atom:updated>2019-10-21T08:02:11.603Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : Snapshot a managed disk via API (an alternative for backing up disk image of 32-bit OS)</h3><p>Here is the API URL:</p><p><a href="https://docs.microsoft.com/en-us/rest/api/compute/snapshots/createorupdate">Snapshots - Create Or Update (Azure Compute)</a></p><p>Here is the body request:</p><pre>{<br>  &quot;properties&quot;: {<br>    &quot;creationData&quot;: {<br>      &quot;createOption&quot;: &quot;Copy&quot;,<br>      &quot;sourceUri&quot;: &quot;/subscriptions/83xxx/resourceGroups/rg-yyy/providers/Microsoft.Compute/disks/win2016dc_OsDiskxxx41&quot;<br>    }<br>  },<br>  &quot;location&quot;: &quot;southeastasia&quot;<br>}</pre><p>Note:</p><p>sourceURI == resource URI, you can get it in the azure portal — VM — disk</p><p>location == where your disk located, not where you want the snapshot to be.</p><p>You can find snapshot lists by typing “snapshot” in the “search box” on top of azure portal (center/middle)</p><p>In theory, here is high level steps to attach it to a new VM:</p><ol><li>Create a managed disk from snapshot above</li></ol><pre>Note that it will ask disk location, etc and when at “source” field, you chose “snapshot”, but then it will check if there is snapshot in that “disk location” you specify.</pre><p>2. Create VM and add above disk</p><pre>But it <strong>may</strong> complain about &quot;subscription and location&quot; of the disk as it can not find it, despite you put the right location.</pre><pre>So you can try this:</pre><pre>Go to the “disk” console (in search box just type “disk”), choose the disk you created from snapshot, then “create VM” from that “disk” console.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3932971bab90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[azure series : Azure file and azure file sync]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-azure-file-and-azure-file-sync-e2c9f2fabaf2?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2c9f2fabaf2</guid>
            <category><![CDATA[file-share]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[sync]]></category>
            <category><![CDATA[azure-files]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 13:29:52 GMT</pubDate>
            <atom:updated>2019-09-18T13:29:52.734Z</atom:updated>
            <content:encoded><![CDATA[<h3>azure series : Azure file and azure file sync</h3><p>Key notes:</p><ol><li>azure file is in storage account</li><li>azure file supports SMB/NFS</li><li>azure filesync is a process (provision via marketplace) to sync your folder to azure file storage.</li><li>If you use azcopy to upload files to azure file, your NTFS ACL will not be preserved, Unlike with azure filesync agent.</li><li>Another option that would transfer with ACLs would be to mount the Azure file share from a Windows VM and then use robocopy command.</li><li>When you create a server endpoint, it actually means you setup which “folder” to sync to, not which server (aka registered server, in which you install filesync agent). Meaning to say, you can have multiple server endpoints in a server (example drive D:\alpha and D:\beta). However, each must connect to different sync group.</li><li>Sync group is a group of 1 cloud endpoint (aka azure file) and 1 (or many) server endpoints (as long the server endpoints are not in same server, notice number 6 above).</li><li>Sync group will sync all the data in to all the members.</li></ol><p>FAQ:</p><ol><li>can 1 server (with 2 different “server endpoints” aka “folders”) connect to 2 different sync groups? [ANSWER] YES, folder 1 with syncgroup1 and folder2 with syncgroup2. You can see it as 1–2–1 relationship between “server endpoint” and “syncgroup”.</li><li>can 1 server which have 2 server endpoints connect to same sync group?[ANSWER] NO</li><li>can we pre-seed azure file with the azcopy command first, only then enable/install/configure the filesync agent on the on-premise server? [ANSWER] Not really, what will happen is that the file you pre-seed will loose its ACL. Then when you enable the filesync, it will have 2 same files, one is with the OS default ACL (which is downloaded from azure file), then the other is got renamed (with suffix of the server name) whose ACL is the correct/expected ACL.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2c9f2fabaf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series : DevOps with IOT Edge]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-devops-with-iot-edge-fa40c76735e9?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa40c76735e9</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[edge]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[marketplaces]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Sun, 28 Jul 2019 10:36:35 GMT</pubDate>
            <atom:updated>2019-07-28T10:36:35.702Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : DevOps with IOT Edge</h3><p>You may follow this link: <a href="https://docs.microsoft.com/en-us/azure/iot-edge/how-to-devops-project">https://docs.microsoft.com/en-us/azure/iot-edge/how-to-devops-project</a></p><p>Keep in mind:</p><ol><li>You create the devops project at Azure Portal, not at devOps portal.</li><li>If you face issue on “marketplace” agreement not accepted during the ubuntu_iot_edge deployment in the pipeline, then run this:</li></ol><pre>PS&gt; az vm image accept-terms --urn microsoft_iot_edge:iot_edge_vm_ubuntu:ubuntu_1604_edgeruntimeonly:latest</pre><p>It can be run on cloud shell, power shell, or cmd prompt.</p><p>In case you would like to do the hard way:</p><pre><strong>Get-AzureRmMarketplaceTerms -Publisher &quot;xxx&quot; -Product &quot;yyy&quot; -Name &quot;zzz&quot; | Set-AzureRmMarketplaceTerms -Accept</strong></pre><p>How to get those parameters’ value:</p><p>$locName=”West US”<br>Get-AzVMImagePublisher -Location $locName | Select PublisherName</p><p>$pubName=”MicrosoftWindowsServer”<br>Get-AzVMImageOffer -Location $locName -PublisherName $pubName | Select Offer</p><p>$skuName=”2019-Datacenter”<br>Get-AzVMImage -Location $locName -PublisherName $pubName -Offer $offerName -Sku $skuName | Select Version</p><p>Result looks like this:</p><pre>“name”: “ubuntu_1604_edgeruntimeonly”,<br>“product”: “iot_edge_vm_ubuntu”,<br>“publisher”: “microsoft_iot_edge”</pre><p>Replace above xxx yyy zzz with above information.</p><p>I also found an issue where the “iotedge” service does not want to run, first it said failed on “dependency”, but after deeper debugging using journalctl -u iotedge, I found out we need to put the connection string (you can find it in iothub and respective device — primary connection string) into inside the yaml file:</p><pre>HostName=iotEdge4Me-iothub.azure-devices.net;DeviceId=myEdgeDevice;SharedAccessKey=&lt;--omitted--&gt;=</pre><p>Yaml file : /etc/iotedge/config.yaml</p><p>Then start:</p><pre>#sudo systemctl start iotedge</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa40c76735e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Series: Calling Azure cosmosDB with mongoDB API]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-calling-azure-cosmosdb-with-mongodb-api-eae2da4e2e37?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/eae2da4e2e37</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 09:17:57 GMT</pubDate>
            <atom:updated>2019-07-12T09:17:57.717Z</atom:updated>
            <content:encoded><![CDATA[<p>You can connect mongodb using mongodb shell:</p><pre>#yum install mongodb</pre><pre>#mongodb &quot;&lt;the_connection_string_you_get_from_azure_portal&gt;&quot;</pre><pre>#show dbs<br>#use &lt;db_name&gt;</pre><pre>#show collections</pre><p>If from jscript, follow these:</p><pre>const routes = require(&#39;express&#39;).Router();</pre><pre>var MongoClient = require(&#39;mongodb&#39;).MongoClient;</pre><pre>const url = &#39;mongodb://mongodbaccount001:&lt;passsword&gt;@mongodbaccount001.documents.azure.com:10255/?ssl=true&amp;replicaSet=globaldb&#39;;</pre><pre>var MongoClient = require(&#39;mongodb&#39;).MongoClient;</pre><pre>MongoClient.connect(url,{ useNewUrlParser: true },function(err,client){</pre><pre>var db = client.db(&#39;test&#39;);</pre><pre>if(err)</pre><pre>{</pre><pre>console.log(err);</pre><pre>}</pre><pre>else</pre><pre>{</pre><pre>console.log(&quot;Connected to db&quot;);</pre><pre>db.collection(&#39;customers&#39;).insert({&quot;doc1&quot;:&quot;hello&quot;},function(err,data){</pre><pre>if(err)</pre><pre>{</pre><pre>throw(err);</pre><pre>}</pre><pre>else</pre><pre>{</pre><pre>console.log(&quot;sucessfuly inserted&quot;);</pre><pre>}</pre><pre>})</pre><pre>}</pre><pre>})</pre><p>Put those lines into a file with js extension, then Run use:</p><pre># node &lt;above_file&gt;.js</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eae2da4e2e37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series : Azure Advisor API]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-azure-advisor-api-6f1612a6a805?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f1612a6a805</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[advisor]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure-services]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 10:33:10 GMT</pubDate>
            <atom:updated>2019-07-09T08:21:09.892Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : Azure Advisor API</h3><p>When you call Azure API management with $filter parameter and face this error message:</p><pre>&quot;message&quot;:&quot;Invalid $filter param&quot;</pre><p>First of all here is $filter rule:</p><pre>1. Do not use {=} symbol, use word <strong>eq <br>$filter =&gt; key eq &#39;value&#39;</strong></pre><pre>2. The value must be quoted by single quote! can not double quote!</pre><p>Here is the API full result:</p><pre>{<br>  &quot;value&quot;: [<br>    {<br>      &quot;id&quot;: &quot;/subscriptions/8395d249-ff40-4fd0-9889-ac39df8f3717/resourceGroups/RG006-APM2/providers/Microsoft.Compute/virtualMachines/vm001/providers/Microsoft.Advisor/recommendations/146db2ec-31d1-bd3b-9c57-36e9d8c5636d&quot;,<br>      &quot;name&quot;: &quot;146db2ec-31d1-bd3b-9c57-36e9d8c5636d&quot;,<br>      &quot;properties&quot;: {<br>        &quot;category&quot;: &quot;Security&quot;,<br>        &quot;impact&quot;: &quot;High&quot;,<br>        &quot;impactedField&quot;: &quot;Microsoft.Compute/virtualMachines&quot;,<br>        &quot;impactedValue&quot;: &quot;vm001&quot;,<br>        &quot;lastUpdated&quot;: &quot;2019-06-26T08:26:45.8830704Z&quot;,<br>        &quot;recommendationTypeId&quot;: &quot;483f12ed-ae23-447e-a2de-a67a10db4353&quot;,<br>        &quot;shortDescription&quot;: {<br>          &quot;problem&quot;: &quot;Virtual machines should be associated with a Network Security Group&quot;,<br>          &quot;solution&quot;: &quot;Virtual machines should be associated with a Network Security Group&quot;<br>        },<br>        &quot;extendedProperties&quot;: {<br>          &quot;assessmentKey&quot;: &quot;483f12ed-ae23-447e-a2de-a67a10db4353&quot;,<br>          &quot;score&quot;: &quot;30&quot;<br>        }<br>      },<br>      &quot;type&quot;: &quot;Microsoft.Advisor/recommendations&quot;<br>    },<br>    {<br>      &quot;id&quot;: &quot;/subscriptions/8395d249-ff40-4fd0-9889-ac39df8f3717/resourceGroups/rg4ever/providers/Microsoft.Compute/virtualMachines/vm001-rhel7/providers/Microsoft.Advisor/recommendations/82541c59-c380-388d-d425-969373a4439f&quot;,<br>      &quot;name&quot;: &quot;82541c59-c380-388d-d425-969373a4439f&quot;,<br>      &quot;properties&quot;: {<br>        &quot;category&quot;: &quot;Cost&quot;,<br>        &quot;impact&quot;: &quot;High&quot;,<br>        &quot;impactedField&quot;: &quot;Microsoft.Compute/virtualMachines&quot;,<br>        &quot;impactedValue&quot;: &quot;vm001-rhel7&quot;,<br>        &quot;lastUpdated&quot;: &quot;2019-06-26T04:23:27.0160472Z&quot;,<br>        &quot;recommendationTypeId&quot;: &quot;e10b1381-5f0a-47ff-8c7b-37bd13d7c974&quot;,<br>        &quot;shortDescription&quot;: {<br>          &quot;problem&quot;: &quot;Right-size or shutdown underutilized virtual machines&quot;,<br>          &quot;solution&quot;: &quot;Right-size or shutdown underutilized virtual machines&quot;<br>        },<br>        &quot;extendedProperties&quot;: {<br>          &quot;deploymentId&quot;: &quot;8018d11a-5cd9-4da1-8061-f669e8112e6a&quot;,<br>          &quot;roleName&quot;: &quot;vm001-rhel7&quot;<br>        }<br>      },<br>      &quot;type&quot;: &quot;Microsoft.Advisor/recommendations&quot;<br>    },</pre><p>You maybe wondering what happened, why the $filter keep getting error despite you use queryString $filter=category eq ‘Cost’. All looks fine, isn’t it?</p><p><strong>Solution</strong>: USE CAPITAL C at the key name, while the case at the value doesnt matter.</p><pre>GET https://management.azure.com/subscriptions/8395d249-ff40-4fd0-9889-ac39df8f3717/providers/Microsoft.Advisor/recommendations?api-version=2017-04-19&amp;%24filter=<strong>C</strong>ategory%20eq%20%27cost%27</pre><p>You will get what you expect:</p><pre>{<br>  &quot;value&quot;: [<br>    {<br>      &quot;id&quot;: &quot;/subscriptions/8395d249-ff40-4fd0-9889-ac39df8f3717/resourceGroups/rg4ever/providers/Microsoft.Compute/virtualMachines/vm001-rhel7/providers/Microsoft.Advisor/recommendations/82541c59-c380-388d-d425-969373a4439f&quot;,<br>      &quot;name&quot;: &quot;82541c59-c380-388d-d425-969373a4439f&quot;,<br>      &quot;properties&quot;: {<br>        &quot;category&quot;: &quot;Cost&quot;,<br>        &quot;impact&quot;: &quot;High&quot;,<br>        &quot;impactedField&quot;: &quot;Microsoft.Compute/virtualMachines&quot;,<br>        &quot;impactedValue&quot;: &quot;vm001-rhel7&quot;,<br>        &quot;lastUpdated&quot;: &quot;2019-06-26T04:23:27.0160472Z&quot;,<br>        &quot;recommendationTypeId&quot;: &quot;e10b1381-5f0a-47ff-8c7b-37bd13d7c974&quot;,<br>        &quot;shortDescription&quot;: {<br>          &quot;problem&quot;: &quot;Right-size or shutdown underutilized virtual machines&quot;,<br>          &quot;solution&quot;: &quot;Right-size or shutdown underutilized virtual machines&quot;<br>        },<br>        &quot;extendedProperties&quot;: {<br>          &quot;deploymentId&quot;: &quot;8018d11a-5cd9-4da1-8061-f669e8112e6a&quot;,<br>          &quot;roleName&quot;: &quot;vm001-rhel7&quot;<br>        }<br>      },<br>      &quot;type&quot;: &quot;Microsoft.Advisor/recommendations&quot;<br>    }<br>  ]<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f1612a6a805" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series : AKS cluster and scale]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-aks-cluster-and-scale-f66b908661c1?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/f66b908661c1</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[autoscaling]]></category>
            <category><![CDATA[autoscale]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-kubernetes-service]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Tue, 18 Jun 2019 13:14:16 GMT</pubDate>
            <atom:updated>2019-06-18T15:20:58.607Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : AKS cluster (node, virtual node) cluster autoscale and HPA</h3><p>Kubernetes support scale (auto and manual) in few layers. Today I am going to describe how AKS support scaling and virtual nodes.</p><p>As in K8s, AKS also support manual scaling and auto scaling. AKS is using VMM scale set as their AKS nodes, however do not change anything on VMM level, instead you need to set the scaling in the AKS nodes level.</p><p>you can set AKS node scaling (aka cluster autoscaler)at the time of cluster creation OR at the runtime as well. It is basically just defining the minimum node and the maximum nodes in that cluster should be.</p><pre>At creation time:</pre><pre>#az aks create \<br>  --resource-group myResourceGroup \<br>  --name myAKSCluster \<br>  --node-count 1 \<br>  --enable-vmss \<br>  --enable-cluster-autoscaler \<br>  --min-count 1 \<br>  --max-count 3</pre><pre>OR at runtime:</pre><pre>#az aks update --resource-group myResourceGroup --name myAKSCluster --enable-cluster-autoscaler   --min-count 1  --max-count 3</pre><p>You can trigger the scale out manually:</p><pre>az aks scale --name MyManagedCluster --node-count 3 --resource-group MyResourceGroup</pre><p>Question : how to set it automatically and what metrics may trigger it??</p><p>This is where the HPA (horizontal pod autoscaler) steps in. Here is how to set HPA, notice the triggered metric here is cpu-percent:</p><pre>#kubectl autoscale deployment aci-helloworld --cpu-percent=20 --min=2 --max=5</pre><p>when average of all pods’ cpu-percentage more than 20%, it will create a new pod and schedule it to run, if no more resource on the nodes, then it will scale out new node (VMM), provided it still below or equal the max nodes we set up. If number of nodes reach max, then the new pod will be scheduled to run once there is available resource in the nodes.</p><p>Here is to check the metrics:</p><pre># kubectl get hpa</pre><pre>NAME             REFERENCE                   TARGETS   MINPODS MAXPODS   REPLICAS   AGE</pre><pre>aci-helloworld   Deployment/aci-helloworld   0%/20%    2         <br>5         2          6h13m</pre><p>If you don’t see the cpu percentage, you need to set the request/limit metrics at the container level, example issue is as below, notice the “&lt;unknown&gt;”:</p><pre># kubectl get hpa</pre><pre>NAME             REFERENCE                   TARGETS   MINPODS MAXPODS   REPLICAS   AGE</pre><pre>aci-helloworld   Deployment/aci-helloworld   &lt;unknown&gt;/20%    2         <br>5         2          6h13m</pre><p>In this case, you need to add these lines (resources|request|limit) at the manifest yaml, notice below i added cpu metric, but you can add on more metrics like mem (as in memory):</p><pre>apiVersion: apps/v1</pre><pre>kind: Deployment</pre><pre>metadata:</pre><pre>  name: aci-helloworld</pre><pre>spec:</pre><pre>  replicas: 1</pre><pre>selector:</pre><pre>  matchLabels:</pre><pre>    app: aci-helloworld</pre><pre>template:</pre><pre>  metadata:</pre><pre>    labels:</pre><pre>      app: aci-helloworld</pre><pre>spec:</pre><pre>  containers:</pre><pre>  - name: aci-helloworld</pre><pre>    image: microsoft/aci-helloworld</pre><pre>    resources:</pre><pre>      requests:</pre><pre>        cpu: 10m</pre><pre>      limits:</pre><pre>        cpu: 600m</pre><pre>    ports:</pre><pre>    - containerPort: 80</pre><p>this manifest file is the one you deployed using this command:</p><pre>#kubectl apply -f manifest_file_name.yaml</pre><p>Basically request means the resource that a pod request to a node, in order for pod to start. If resource N/A then pod will be in waiting list. Limit means to limit the resource of the pod.</p><p>By the way, here is what “NODES” looks like when we have virtual node enabled:</p><pre>#kubectl get nodes</pre><pre>NAME                                STATUS   ROLES   AGE   VERSION<br>aks-agentpool-27150641-vmss000000   Ready    agent   10h   v1.12.8<br>virtual-node-aci-linux              Ready    agent   10h   v1.13.1-vk-v0.9.0-1-g7b92d1ee-dev</pre><p>Notice the first line above is the VMM (node) and the second line is the ACI instance (virtual node).</p><p>There is however an issue when you set up that resource|request|limit, then deploy it to virtual node (using nodeSelector and toleration), it will fail with error “providerFailed” at the “status” field of the container when you run “kubectl get pods” command.</p><p>Here is sample of additional lines to manifest file .yaml to favor it to virtual nodes, notice that nodeSelector indentation is under “spec:” (in another word it is same lineage with “containers:” :</p><pre>      nodeSelector:</pre><pre>        kubernetes.io/role: agent</pre><pre>        beta.kubernetes.io/os: linux</pre><pre>        type: virtual-kubelet</pre><pre>      tolerations:</pre><pre>      - key: virtual-kubelet.io/provider</pre><pre>        operator: Exists</pre><pre>      - key: azure.com/aci</pre><pre>        effect: NoSchedule</pre><p>My conclusion for now, you can only use this autoscale method at vmm backed nodes, not at aci instance backed node (aka virtual node).</p><p>For virtual node autoscale you can follow this github repository which is using prometheus operator to trigger the scale out automatically based on average pods’ request/second.</p><p><a href="https://github.com/Azure-Samples/virtual-node-autoscale">Azure-Samples/virtual-node-autoscale</a></p><p>Here is the link to node affinity, taint (anti affinity) and toleration if you would like to learn more and attach the pod to either vmm backed node or virtual node.</p><p><a href="https://docs.microsoft.com/en-us/azure/aks/operator-best-practices-advanced-scheduler">Operator best practices - Advanced scheduler features in Azure Kubernetes Services (AKS)</a></p><p>Just in case you found some issue, there are few things to check, like ensuring container service is registered, check with this command:</p><pre>#az provider list --query &quot;[?contains(namespace,&#39;Microsoft.ContainerInstance&#39;)]&quot; -o table</pre><pre>Namespace                    RegistrationState<br>---------------------------  -------------------<br>Microsoft.ContainerInstance  Registered</pre><pre><br>To register:</pre><pre>#az provider register --namespace Microsoft.ContainerInstance</pre><p>You may also want to check if metrics-server pod created or not, using below command:</p><pre>#kubectl get pods --all-namespaces</pre><pre>NAMESPACE     NAME                                    READY   STATUS    RESTARTS   AGE</pre><pre>-- omitted ---<br>kube-system   metrics-server-67c75dbf7-hwhs9          1/1     Running   1          12h<br>--omitted --</pre><p>If not, then you must have used old kubernetes cluster version, so you need to deploy metrics-server pod above manually.</p><p>Lets do scale out testing with HPA (on VMM backed nodes)!</p><p>First create a testing pod in same subnet, check the aci_helloworld pod’s ip address, then you go inside the testing pod and run infinite loop curl:</p><pre>#kubectl run -it virtual-node-test --image=debian</pre><pre># kubectl get pods -o wide<br>NAME                                 READY   STATUS    RESTARTS   AGE   IP            NODE                                NOMINATED NODE</pre><pre>aci-helloworld-54845ddb8b-5ftmb      1/1     Running   0          8h    10.240.0.12   aks-agentpool-27150641-vmss000000   &lt;none&gt;</pre><pre>aci-helloworld-54845ddb8b-b25vm      1/1     Running   0          8h    10.240.0.21   aks-agentpool-27150641-vmss000000   &lt;none&gt;</pre><pre>virtual-node-test-57dfdc6fb9-s65j7   1/1     Running   5          11h   10.240.0.23   aks-agentpool-27150641-vmss000000   &lt;none&gt;</pre><pre>#kubectl attach  virtual-node-test-57dfdc6fb9-s65j7  -c virtual-node-test -i -t</pre><pre>root@virtual-node-test-57dfdc6fb9-s65j7:/# apt-get updates<br>root@virtual-node-test-57dfdc6fb9-s65j7:/# apt-get install -y curl<br>root@virtual-node-test-57dfdc6fb9-s65j7:/# curl -L <a href="http://ip_address_/">http://</a>10.240.0.12<br>root@virtual-node-test-57dfdc6fb9-s65j7:/# while :; do curl -L <a href="http://one_of_the_ip_address/">http://</a>10.240.0.12 &gt; /dev/null ; done;</pre><p>While this running, you may open new power shell session and run this command:</p><pre># kubectl get hpa --watch<br>NAME             REFERENCE                   TARGETS   MINPODS   MAXPODS   REPLICAS   AGE<br>aci-helloworld   Deployment/aci-helloworld   0%/20%    2         5         2          8h<br>aci-helloworld   Deployment/aci-helloworld   165%/20%   2     5     2     8h<br>aci-helloworld   Deployment/aci-helloworld   165%/20%   2     5     4     8h<br>aci-helloworld   Deployment/aci-helloworld   165%/20%   2     5     5     8h<br>aci-helloworld   Deployment/aci-helloworld   350%/20%   2     5     5     8h<br>aci-helloworld   Deployment/aci-helloworld   74%/20%   2     5     5     8h<br>aci-helloworld   Deployment/aci-helloworld   0%/20%   2     5     5     8h<br>aci-helloworld   Deployment/aci-helloworld   0%/20%   2     5     5     8h<br>aci-helloworld   Deployment/aci-helloworld   0%/20%   2     5     2     8h</pre><p>It may take some time, but after awhile it will reach 165%, then replica becomes 4 (previously 2), then it becomes 5 (max pods). Load keeps increasing into 350%, but no more pods created as the max pods is 5. At this point, i break the infinite test loop, so load back to 0%, then you can notice the replica scale down to 2 (previously 5).</p><p>After testing done, you may want to remove all the testing pods with these commands:</p><pre>#kubectl delete deploy/aci-helloworld<br>#kubectl delete hpa aci-helloworld</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f66b908661c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series: Sync MSSQL database to Azure SQL Paas (Not SQL MI)]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-sync-mssql-database-to-azure-sql-paas-not-sql-mi-4b3bec76ee9f?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b3bec76ee9f</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[paas]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[mssql]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Thu, 30 May 2019 04:55:53 GMT</pubDate>
            <atom:updated>2019-05-30T04:55:53.052Z</atom:updated>
            <content:encoded><![CDATA[<p>When you need on-premise MSSQL DB sync to Azure SQL PaaS, you can select which DB, which tables and which fields to sync. It supports one way and bi-directional sync as well.</p><p>Things to be aware of:</p><ol><li>You can only sync table with Primary key, please advise your DBA to create PK on the table, as it would be a recommended design for each table to have PK.</li><li>Sync happen at DB level, not at the Server level.</li><li>Need agent to be install on-premise, and Azure firewall need to allow the agent’s ip address.</li><li>Once you set up, then you see status is NOT READY, it is because you need to select which table/field to be sync’ed.</li><li>Sync frequency is 5 minutes to few days. You can set it up.</li><li>You need to enter on-premise MSSQL username / password during the setup at azure portal.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b3bec76ee9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series : ADFS, AD Connect — Pass through, AD Connect — hash sync and AAD Application proxy]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-adfs-ad-connect-pass-through-ad-connect-hash-sync-and-aad-application-proxy-8d2ab9826307?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d2ab9826307</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[adfs-multidomain]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Wed, 29 May 2019 15:30:24 GMT</pubDate>
            <atom:updated>2019-05-31T04:34:15.247Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure series : ADFS, AD Connect — Pass through, AD Connect — hash sync and AAD Application proxy</h3><p><strong>Azure Active Directory (AAD)</strong> is Identity and Access Management on Azure cloud.</p><p><strong>AD DS (Directory service) </strong>is a DCaaS (domain controller) as a Service, you could not use to replicate your existing Active Directory implementation to the cloud. It is a stand-alone service that can offer domain services to your Azure VMs and your directory-aware applications if you decide to move them to Azure infrastructure services. But with no replication to any other on-premises or cloud (in a VM) domain controller.</p><p><strong>ADFS (AD Federation Service)</strong></p><p>ADFS server (STS token generator) is in on-premise (or vnet but with integration to on-premise either with S2S VPN or ExpressRouter), AD FS proxy is in DMZ. SaaS (cloud) application used this way to enable SSO. AuthN process happen at AD on-premise.</p><p><strong>AD Connect — Hash Sync</strong></p><p>Facilitate sync user attribute and password hash from AD on-premise to AAD.</p><p>User can be authNticated at on-premise and/or on the cloud as well.</p><p><strong>AD connect — Pass through</strong></p><p>AuthN happen at on-premise. AAD just passing it through.</p><p><strong>AAD Application proxy</strong></p><p>On-premise application to have SSO capability by authenticated against AAD.</p><p>No VPN required.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d2ab9826307" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure series: How to identify your Azure ASE using ILB or ELB]]></title>
            <link>https://medium.com/@alfred_lim/azure-series-how-to-identify-your-azure-ase-using-ilb-or-elb-a42c556d1f17?source=rss-b29871d01b96------2</link>
            <guid isPermaLink="false">https://medium.com/p/a42c556d1f17</guid>
            <category><![CDATA[azure-services]]></category>
            <category><![CDATA[azure-app]]></category>
            <category><![CDATA[azure-app-service]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[alfred lim]]></dc:creator>
            <pubDate>Wed, 29 May 2019 10:42:08 GMT</pubDate>
            <atom:updated>2019-05-29T14:31:44.488Z</atom:updated>
            <content:encoded><![CDATA[<p>At ASE — IP addresses section, you will see these if it uses ELB:</p><pre>Domain/subdomain name: {{ase_name}}.p.azurewebsites.net</pre><pre>Outbound IP address xxx.xxx.xxx.xxx</pre><pre>Public IP address xxx.xxx.xxx.xxx</pre><p>Otherwise you will see this:</p><pre>Domain/subdomain name: {{ase_name}}.appserviceenvironment.net</pre><pre>Internal Load Balancer IP address 10.1.0.11</pre><pre>Outbound IP address xxx.xxx.xxx.xxx</pre><pre>Management IP address xxx.xxx.xxx.xxx</pre><p>Another way, you can go to resource explorer:</p><pre>subscriptions/{{subscription_id}}/resourceGroups/{{rg_name}}/providers/Microsoft.Web/hostingEnvironments/{{ase_name}}</pre><p>Notice below example on ELB:</p><pre>“internalLoadBalancingMode”: “None”,</pre><p>As opposed to ILB:</p><pre>“internalLoadBalancingMode”: “Web, Publishing”,</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a42c556d1f17" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>