<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>GERMANageability 365 degree</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/germanageability/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/germanageability/feed.xml</link>
    <description>Notes from the field of the German manageability and monitoring engineers</description>
    <lastBuildDate>Tue, 16 Apr 2019 06:07:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Remote support solution for high secure Workstations</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/remote-support-solution-for-high-secure-workstations</link>
      <pubDate>Tue, 04 Sep 2018 14:53:33 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2415</guid>
      <description><![CDATA[This post is completely unrelated to all the other usual topics on this blog. But as it is related...]]></description>
      <content:encoded><![CDATA[This post is completely unrelated to all the other usual topics on this blog. But as it is related to management and might help some people I want to share this solution.
<h3>Scenario &amp; Challenge</h3>
A lot of customers are using high secure Workstations (or <a target="_blank" href="https://blogs.technet.microsoft.com/datacentersecurity/2017/10/13/privileged-access-workstationpaw/" rel="noopener">Privileged Access Workstation (PAW)</a> as we call it). These workstations may run Windows or Linux and are usually completely locked down and have no Internet access. They are used to access highly secure environments (like AD Domain Controller and other Tier 0 systems e.g.).
What if you have an issue in this environment and need vendor support (like Microsoft Support)? Giving an Engineer remote access or at least share the screen with him will usually solve issues much faster than sending log files and screenshots back and forth.
But with a high secure Workstation, that is usually impossible due to the security restrictions...
<h3>Solution</h3>
Today I was on a customer site in the exact same situation. PAW, no Internet access whatsoever, completely locked down and an urgent support case with a colleague in India waiting to have a look at the issue in real time.
Fortunately the customer was quite clever and found a solution for it, which I am allowed to share with you:

<a href="https://msdnshared.blob.core.windows.net/media/2018/09/2018-09-04_14-40-51.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/09/2018-09-04_14-40-51.jpg" alt="" width="2726" height="857" class="alignnone size-full wp-image-2425" /></a>

The customer found a device (Elgato Camlink), that is usually used to take high resolution screenshots for Gaming. You connect this device to your connected workstation (unsecure, Tier 2). It does not require any driver installation on Windows 10 and gets installed as a Camera device.
The other end of the Camlink device gets connected to the secure Workstation via HDMI cable. On the secure Workstation, the Camlink appears as a second screen and does not require any drivers to be installed also!

Once you did the cabling, you simply duplicate your screen on the secure Workstation and open up the Camera App on Windows 10 to see the live stream! You can then share the Camera App with the remote Support engineer.

<a href="https://msdnshared.blob.core.windows.net/media/2018/09/20180904_115935380_iOS.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/09/20180904_115935380_iOS.jpg" alt="" width="1019" height="750" class="alignnone size-full wp-image-2435" /></a>

Isn't that a neat solution?
You can share the screen without compromising the security of your secure workstation and your secure environment. No Admin rights are required and nobody can control the secure workstation, even if the connected workstation has been compromised...]]></content:encoded>
    </item>
    <item>
      <title>Installing and testing the new Azure Security Center Preview Cmdlets</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/installing-and-testing-the-new-azure-security-center-preview-cmdlets</link>
      <pubDate>Tue, 04 Sep 2018 08:58:29 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2365</guid>
      <description><![CDATA[UPDATE 23.09.2018: New Version 0.2 available. Works with the most current AzureRM.Profile...]]></description>
      <content:encoded><![CDATA[<span style="color: #ff0000"><strong>UPDATE 23.09.2018: New Version 0.2 available. Works with the most current AzureRM.Profile now</strong></span>

<span style="color: #ff0000"><strong>CAUTION: This post handles pre-release software. Please test carefully in your Lab/Test environment first!</strong></span>

Last week the Azure Security Center (ASC) team released a preview of a new PowerShell module: <a href="https://www.powershellgallery.com/packages/AzureRM.Security/0.1.0-preview">AzureRM.Security</a> center that allows for managing ASC automatically.

The current version contains these Cmdlets:
<table border="0" cellpadding="0" cellspacing="0" width="134" style="border-collapse: collapse;width: 466px"><colgroup> <col width="67" span="2" style="width: 50pt" /> </colgroup>
<tbody>
<tr style="height: 14.4pt">
<td height="19" width="67" style="height: 14.4pt;width: 50pt"><strong>Name</strong></td>
<td width="67" style="width: 50pt"><strong>Version</strong></td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmDiscoveredSecuritySolution</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmExternalSecuritySolution</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmJitNetworkAccessPolicy</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityAlert</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityAutoProvisioningSetting</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityCompliance</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityContact</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityLocation</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityPricing</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityTask</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Get-AzureRmSecurityWorkspaceSetting</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Remove-AzureRmJitNetworkAccessPolicy</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Remove-AzureRmSecurityContact</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Remove-AzureRmSecurityWorkspaceSetting</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmJitNetworkAccessPolicy</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmSecurityAlert</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmSecurityAutoProvisioningSetting</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmSecurityContact</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmSecurityPricing</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Set-AzureRmSecurityWorkspaceSetting</td>
<td>0.1.0</td>
</tr>
<tr style="height: 14.4pt">
<td height="19" style="height: 14.4pt">Start-AzureRmJitNetworkAccessPolicy</td>
<td>0.1.0</td>
</tr>
</tbody>
</table>
&nbsp;

With this module, you can configure important parts of your ASC automatically (e.g. enable Auto Provisioning, get ASC Alerts etc.).
<h3>Requirements</h3>
This module has some requirements:
<ol>
 	<li>It needs the latest version (1.6.7) of PowerShellGet</li>
 	<li>It needs a specific version of the AzureRM.Profile (5.5.0)</li>
</ol>
&nbsp;
<h3>Install the module</h3>
To test this module, you have to follow these steps:
<ol>
 	<li>Open an admin PowerShell console</li>
 	<li>Update PowerShellGet
<pre>PS&gt;<span>Install-Module -Name PowerShellGet -Force</span></pre>
</li>
 	<li>Install the right AzureRM.Profile version (in addition to newer versions that might already exists on your system)
<pre>PS&gt;Install-Module -name AzureRM.Profile -requiredversion 5.5.0</pre>
</li>
 	<li>Install the new ASC module
<pre>PS&gt;<span>Install-Module -Name AzureRM.Security -AllowPrerelease</span></pre>
</li>
 	<li>Close the PowerShell</li>
</ol>
&nbsp;
<h3>Test the new module</h3>
<ol>
 	<li>Open a new PowerShell console</li>
 	<li>Import <span>AzureRM.Security</span>
<pre>PS&gt;import-module <span>AzureRM.Security</span></pre>
</li>
 	<li>Log on to Azure with an Account that has access to ASC
<pre>PS&gt; Connect-AzureRmAccount</pre>
</li>
 	<li>Test the Cmdlets, e.g.
<pre>PS&gt; Get-AzureRmSecurityAlert</pre>
<pre><a href="https://msdnshared.blob.core.windows.net/media/2018/09/2018-09-04_09-51-20.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/09/2018-09-04_09-51-20.jpg" alt="" width="711" height="270" class="alignnone wp-image-2375" /></a></pre>
</li>
</ol>
&nbsp;

Happy testing!

If you notice any issues or have questions, please visit the PowerShell Gallery: <a href="https://www.powershellgallery.com/packages/AzureRM.Security/0.1.0-preview">https://www.powershellgallery.com/packages/AzureRM.Security/0.1.0-preview</a>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Quick note: PoSh function to show discovery sources for SCOM class properties</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/quick-note-posh-function-to-show-discovery-sources-for-scom-class-properties</link>
      <pubDate>Wed, 15 Aug 2018 08:01:59 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2335</guid>
      <description><![CDATA[This week, I needed to troubleshoot some properties, that did not get discovered. For this, I needed...]]></description>
      <content:encoded><![CDATA[This week, I needed to troubleshoot some properties, that did not get discovered. For this, I needed to know, which discovery rules are responsible for discovering these particular properties.

I did not want to search all MPs for that, so I wrote a small function, that helps me to gather this information:

This function creates a collection of custom objects for each property. The custom object contains information about the property, the parent class and the discovery rule.

Requirements for this function:
- Function supports SCOM 2012/2016
- Function must be executed in a shell with a loaded and configured SCOM 2012/2016 Module
- User needs at least Advanced Operator right in SCOM

<a href="https://msdnshared.blob.core.windows.net/media/2018/08/2018-08-15_08-27-41-2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/08/2018-08-15_08-27-41-2.jpg" alt="" width="2422" height="663" class="alignnone size-full wp-image-2355" /></a>

The screenshot above shows the function in action by searching for a property called "ActiveDirectorySite".

As I think that this function could be helpful for you as well, I published it on <a target="_blank" href="https://gallery.technet.microsoft.com/Function-to-show-discovery-51fa2c87" rel="noopener">TechnetGallery</a>.

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Creating Logic App API connection to query a Log Analytics workspace via ARM template</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/creating-logic-app-api-connection-to-query-a-log-analytics-workspace-via-arm-template</link>
      <pubDate>Wed, 09 May 2018 18:57:56 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2165</guid>
      <description><![CDATA[It has been a while since my last post. I turn more and more into cloud-based monitoring and this...]]></description>
      <content:encoded><![CDATA[It has been a while since my last post. I turn more and more into cloud-based monitoring and this journey is quite fascinating. I constantly stumble upon various things and will blog about the experiences I made in the future.
<h3>Scope</h3>
I really do like Azure Logic Apps to automate things in Azure and to transfer data from or to Log Analytics. Creating Logic Apps in the portal is quite easy, but if you try to automate things with ARM templates, there are some pitfalls.

Let’s assume, you want to create an ARM template for a simple logic App with
<ul>
 	<li>One trigger: Recurrence
Trigger every x Minutes</li>
 	<li>One action: Run query and list result
Execute a query against a Log Analytics workspace and return the result as JSON objects</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_16-55-00.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_16-55-00.jpg" alt="" width="516" height="289" class="alignnone wp-image-2175" /></a>
The “Run query and list result” action needs an authenticated API connection to the Log Analytics workspace. How do we create this within an ARM template? Unfortunately, there is not a very precise documentation and it took me a while to accomplish that.

This post describes how to configure the undocumented settings within the ARM template, to make the API connection work.

<strong>This post is not a step-by-step introduction on how to write the full ARM template!</strong>
<h3>Requirements</h3>
What do we need?
<ol>
 	<li>A ServicePrincipal
For detailed instruction on how to create a ServicePrincipal see <a target="_blank" href="https://docs.microsoft.com/de-de/azure/azure-resource-manager/resource-group-create-service-principal-portal" rel="noopener">https://docs.microsoft.com/de-de/azure/azure-resource-manager/resource-group-create-service-principal-portal</a> . For our  template we need:
- Client-ID (APP-ID)
- Our Tenant-ID
- The App secret</li>
 	<li>An export of a working Logic App as an ARM template.
It is much easier to build a PoC in the Azure Portan and than export it into an ARM template. That export can be done either in the Azure portal or with Visual Studio. Within Visual Studio you can use the Cloud Explorer to navigate to your Logic App and  open it with the Logic App Editor. There you can download the template:
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_19-19-01.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_19-19-01.jpg" alt="" width="700" height="388" class="alignnone wp-image-2195" /></a></li>
</ol>
<h3>Creating the base ARM template</h3>
You can create the ARM template with whatever editor you like. I prefer Visual Studio 2017 with all ARM tools installed.

My template will contain just a bunch of parameters and two resources:
<ul>
 	<li>One resource for the logic app</li>
 	<li>One resource for the API connection</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-46-52.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-46-52.jpg" alt="" width="353" height="313" class="alignnone size-full wp-image-2205" /></a>
When you look at the API resource, you can see some parameters :

<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-55-00.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-55-00.jpg" alt="" width="664" height="235" class="alignnone wp-image-2215" /></a>

<strong>Keep in mind: these parameters are ONLY available when exported with Visual Studio and NOT via Azure Portal!</strong>

The needed parameters are:
<ul>
 	<li><strong>"token:clientId"</strong>
This is our Client ID</li>
 	<li><strong>"token:clientSecret"</strong>
This is our App secret</li>
 	<li><strong>"token:TenantId"</strong>
This is our TenantID</li>
 	<li><strong>"token:grantType”</strong>
Must be “client_credentials”</li>
 	<li><span style="color: #ff0000"><strong>"token:resourceUri"</strong></span>
This parameter caused me a lot of headache, as Visual Studio does not dump its value and I could not find the correct value anywhere in the LogicApp documentation. After a lot of try and error I figured out, that it has to be <span style="color: #ff0000"><strong>https://management.azure.com/</strong></span>.</li>
</ul>
A working sample of the full ARM template is attached to the blog post for you as a reference.
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/azuredeploy.json_.txt">ARM Template</a>
<h3>Testing the ARM template</h3>
Once you have created the template, you can deploy it to your resource group (“BlogDemoLogicApp” in my case) via Visual Studio:
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_18-01-30.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_18-01-30.jpg" alt="" width="704" height="261" class="alignnone wp-image-2235" /></a>
The result is a working API connection…
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_16-56-13.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_16-56-13.jpg" alt="" width="704" height="120" class="alignnone wp-image-2245" /></a>
… and a running Logic App:
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-30-00.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_17-30-00.jpg" alt="" width="707" height="443" class="alignnone wp-image-2255" /></a>
<h3></h3>
<h3>My personal lessons learned</h3>
<ol>
 	<li><strong>Create a PoC in Azure Portal first</strong>
Having this PoC as a starting point and not needing to start from scratch is very helpful. Just keep in mind, that you have to clean up the exported template later on.</li>
 	<li><strong>Use Visual Studio</strong>
Yes, it is complex, and I do only understand a fraction of its capabilities, but it simplifies your journey into Azure a lot!</li>
 	<li><strong>Exporting templates from Azure Portal is not always a good idea.</strong>
Some settings/parameters might be missing. Especially in the API connection case. Use Visual Studio instead and get at least all parameters (unfortunately not all needed values).</li>
 	<li><strong>Use the Logic App “Run Details” function in the “Run History”</strong>
to get deep error messages for a failed action. They can be much more descriptive than the errors in the visual designer:
<a href="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_18-16-09.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/05/2018-05-09_18-16-09.jpg" alt="" width="765" height="162" class="alignnone wp-image-2225" />
</a></li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Methode GetFailoverManagementServers() is very slow? Here's a faster methode to collect failover configuration from scom agents</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/methode-getfailovermanagementservers-is-very-slow-heres-a-faster-methode-to-collect-failover-configuration-from-scom-agents</link>
      <pubDate>Wed, 13 Dec 2017 09:29:30 GMT</pubDate>
      <dc:creator><![CDATA[Daniel Mueller]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2106</guid>
      <description><![CDATA[In some cases, it is necessary to review the Primary and Failover Management Server configuration of...]]></description>
      <content:encoded><![CDATA[In some cases, it is necessary to review the Primary and Failover Management Server configuration of your window SCOM agents.

Most customer are using PowerShell to receive those information

for Example:
<p style="padding-left: 30px"><strong>$agent = get-scomagent -Name "name.of.my.agent"</strong>
<strong>$agent.PrimaryManagmentServer</strong>
<strong>$agent.GetFailoverManagementServers()</strong></p>
Depends on the size of your environment calling the method <em>GetFailoverManagementServers()</em> might take several seconds per agent.
<p style="padding-left: 30px"><strong>Measure-command {$agent.GetFailoverManagementServers()}</strong></p>
<p style="padding-left: 30px">Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 26
Milliseconds      : 44
Ticks             : 260445702
TotalDays         : 0,000301441784722222
TotalHours        : 0,00723460283333333
TotalMinutes      : 0,43407617
<strong>TotalSeconds      : 26,0445702</strong>
TotalMilliseconds : 26044,5702</p>
If you need to review the failover configuration of all your Windows SCOM agents, this might take several hours to run completely against all your agents.

Hmm.... "<em>OK, what can I do to avoid such a long runtime?"</em>

Theoretically you could call this information directly via SQL DB query, But I wouldn't recommend doing this, because you can't rely in long-term on the database query in case that the SCOM product group decides to change or optimize anything in the DB table structure in any future update rollup. Therefore, I'd like to show you another way with PowerShell.

There is another method to call the failover information from SCOM in a much faster way.
<h3>Background information:</h3>
There are two relationships that reflects the relations between SCOM Agent and its communication partners (Primary and Failover Management Servers)

<strong>Primary Management Server</strong>

ID                           : <span style="color: #3366ff"><strong>37848e16-37a2-b81b-daaf-60a5a626be93</strong></span>
DisplayName    : Health Service Communication
Source                 : Microsoft.SystemCenter.HealthService
Target                  : Microsoft.SystemCenter.HealthService

<strong>Failover Managment Server(s)
</strong>ID                           :<span style="color: #3366ff"><strong> ca26f3f0-b8ce-c193-d6df-632d53dee714</strong></span>
DisplayName    : Health Service Failover Communication
Source                 : Microsoft.SystemCenter.HealthService
Target                  : Microsoft.SystemCenter.HealthService

Using this relationship is much faster than calling the agent method GetFailoverManagementServers()
<h3>Solution:</h3>
<strong>Important!</strong> Instead of Get-ScomAgent (this returns an instance of AgentManagedComputer), you need to use HealthService class instance in this case.
<p style="padding-left: 30px"><strong>$Class   = Get-SCOMClass -Name Microsoft.SystemCenter.HealthService</strong>
<strong>$Agent = Get-SCOMClassInstance -Class $class | Where-Object {$_.DisplayName -eq "name.of.my.agent" }</strong>
<strong>Get-SCOMRelationshipInstance -SourceInstance $agent | ? {(($_.RelationshipId -eq <span style="color: #3366ff">'37848e16-37a2-b81b-daaf-60a5a626be93'</span>) -or ($_.RelationshipId -eq <span style="color: #3366ff">'ca26f3f0-b8ce-c193-d6df-632d53dee714'</span>)) -and ($_.IsDeleted -eq $False)} | Sort TargetObject | FT SourceObject,TargetObject,RelationshipId</strong></p>
Measuring this command shows us a significant faster runtime of just a few milliseconds
<p style="text-align: left;padding-left: 30px"><strong>Measure-command {Get-SCOMRelationshipInstance -SourceInstance $target | ? {($_.RelationshipId -eq '37848e16-37a2-b81b-daaf-60a5a626be93') -or ($_.RelationshipId -eq 'ca26f3f0-b8ce-c193-d6df-632d53dee714')} | Sort TargetObject | FT SourceObject,TargetObject,RelationshipId }</strong></p>
<p style="padding-left: 30px">Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
<strong>Milliseconds      : 94</strong>
Ticks             : 948595
TotalDays         : 1,09791087962963E-06
TotalHours        : 2,63498611111111E-05
TotalMinutes      : 0,00158099166666667
TotalSeconds      : 0,0948595
TotalMilliseconds : 94,8595</p>
I think <strong>94 ms vs. 26 Sec</strong>. ..... this could help speeding up your scripts a bit ;-)

Have Fun!

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Quick Note: RunbookService might fail to start after applying System Center Orchestrator 2016 UR4</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/quick-note-runbookservice-might-fail-to-start-after-applying-system-center-orchestrator-2016-ur4</link>
      <pubDate>Tue, 14 Nov 2017 20:56:50 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2145</guid>
      <description><![CDATA[UPDATE 15.11.2017: KB article is now updated and contains native SQL client as a pre-requisite for...]]></description>
      <content:encoded><![CDATA[<span style="color: #339966"><strong>UPDATE 15.11.2017: KB article is now updated and contains native SQL client as a pre-requisite for UR4!</strong></span>

Today I ran into an issue at a customer site while updating a SCORCH 2016 UR1 installation with UR4:

<strong>CAUTION:</strong>
<strong>After applying the UR4 patch for the management server and the runbook service you need to re-configure the Database Connection with the DataStore Utility (DBSETUP.EXE). This is described in the corresponding KB article <a target="_blank" href="https://support.microsoft.com/en-us/help/4047355/update-rollup-4-for-system-center-2016-orchestrator" rel="noopener">here</a>, but not very prominent. I missed it the first time :) </strong>
<span style="color: #ff0000"><strong>If you do not run the DataStore Configuration tool to re-configure the database, your Runbook Service will not start!</strong></span>
<h3>Issue</h3>
In the case of my customer, we could start the DataStore Configuration tool, enter the SQL Server but when we wanted to select the existing database, the tool produced an empty error message and an empty database list box. The Runbook Service failed to start and produced an error like "Unknown database type" in the corresponding log file.
I traced the DBSETUP.EXE process with Procmon on an UR1 and UR4 box and noticed, that the UR4 version did not create any network connectivity at all.

It turned out that the UR4 version of DBSETUP.EXE and the RunbookService is linked against some newer SQL libraries that were not installed on this customer machine. Thanks to my Support colleague Omar AlOmari  for figuring this out!
<h3>Solution</h3>
Installing the SQL 2012 SP4 native client (ENU\x64\sqlncli.msi) from <a target="_blank" href="https://www.microsoft.com/en-us/download/details.aspx?id=56041" rel="noopener">https://www.microsoft.com/en-us/download/details.aspx?id=56041 </a>did the trick. After installing this client, the UR4 version of DBSETUP.EXE runs smoothly as well as the Runbook Service.

If your server already has a newer version of the native SQL client installed, you will most probably not run into this issue.

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Add-on MP for Windows 2012/2016 AD RID issuance monitoring</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/add-on-mp-for-windows-20122016-ad-rid-issuance-monitoring</link>
      <pubDate>Wed, 25 Oct 2017 17:52:25 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=2115</guid>
      <description><![CDATA[Disclaimer:
The scenario described in this post and covered by the attached Add-on MPs is most...]]></description>
      <content:encoded><![CDATA[<strong>Disclaimer</strong>:
The scenario described in this post and covered by the attached Add-on MPs is most likely only relevant for large enterprise customers. The MPs described in this post are not a Microsoft product and thus not covered by any Microsoft support or warranty! They should be carefully analyzed and tested in your test environment before using them in any productive SCOM Management Group.

Last week a customer pointed me to a <a target="_blank" href="https://blogs.technet.microsoft.com/askds/2012/08/10/managing-rid-issuance-in-windows-server-2012/" rel="noopener noreferrer">blog post</a> called "Managing RID Issuance in Windows Server 2012" that describes new features in Windows 2012 and onwards regarding new RID pool events created by these OS.  That blog post later made it into our official <a target="_blank" href="https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/managing-rid-issuance" rel="noopener noreferrer">Windows Server documentation</a>.
He asked me, if these events were covered (monitored) in our current AD Management Packs. But a quick search in our former (v6) and new (v10) AD MP revealed, that we collect only the “AD RID Pool Free Performance Collection” Perfcounter (amount of free % in the AD RID pool) and some counters that monitor the RID Master latency. But the new events described in the post are not covered by our current AD MPs.

I tried to talk my way out by saying it is highly unlikely that a customer will ever come into a situation where a RID pool gets depleted (Who has ever created one billion objects?). But unfortunately the recommendation of the blog post is unambigous:
<em>“Automated AD health tracking systems, such as System Center Operations Manager, should monitor for these events; all are notable, and some are indicators of critical domain issues.”
</em>
So I created a <a target="_blank" href="https://gallery.technet.microsoft.com/Add-on-MP-for-Windows-92c5f00b" rel="noopener noreferrer">little Add-On MP</a> that contains six simple alert rules based on event collection for the Events 16653-16658. The rules are targeted against the Domain Controller role.
<a href="https://msdnshared.blob.core.windows.net/media/2017/10/2017-10-22_13-53-13.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/10/2017-10-22_13-53-13.png" alt="" class="alignnone size-full wp-image-2136" width="869" height="500" /></a>

The MP does not contain any classes, folders or views and will work with SCOM2012R2 and SCOM2016. The contained rules will simply generate an descriptive alert if one of the critical RID events will occur on one of your targeted DC.

<a href="https://msdnshared.blob.core.windows.net/media/2017/10/2017-10-22_13-39-56.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/10/2017-10-22_13-39-56.png" alt="" class="alignnone size-full wp-image-2126" width="547" height="348" /></a>

Because Windows 2012 DC are currently covered by either our old v6 AD MP or our new v10 MP I created three different versions of the MP:
<ul>
 	<li>Community Add-On RID issuance Monitoring for AD 2008-2012 MP v6
Needed if you still use our v6 AD MP</li>
 	<li>Community Add-On RID issuance Monitoring for AD 2012 MP v10
Needed, if you use our new v10 AD MP with Windows 2012(R2)</li>
 	<li>Community Add-On RID issuance Monitoring for AD 2016 MP v10
Needed, if you use our new v10 AD MP with Windows 2016</li>
</ul>
If you use Windows 2012 and Windows 2016 on your DCs, simply import both MPs.

You can download the MPs from <a target="_blank" href="https://gallery.technet.microsoft.com/Add-on-MP-for-Windows-92c5f00b" rel="noopener noreferrer">Technet Gallery</a>.]]></content:encoded>
    </item>
    <item>
      <title>Monitoring temperature sensors in remote locations with Twilio, Azure Automation and Log Analytics - Part 3</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-3</link>
      <pubDate>Tue, 05 Sep 2017 16:49:16 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=1995</guid>
      <description><![CDATA[This is part three of my little three part series on how to monitor temperature sensors in  remote...]]></description>
      <content:encoded><![CDATA[This is part three of my little three part series on how to monitor temperature sensors in  remote locations with Twilio, Azure Automation and OMS. It describes my current OMS solution and the costs associated with the solution, in case that you want to build something similar.
For the background of this post, please read <a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-1/" rel="noopener noreferrer">part one</a>. <a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-2/" rel="noopener noreferrer">Part two</a> describes some of the technical aspects and lessons learned.

Let me show you once again the complete custom OMS solution dashboard:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/SolutionDashboardv2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/SolutionDashboardv2.jpg" alt="" class="alignnone size-full wp-image-1925" width="1708" height="396" /></a>

&nbsp;
<h3>OMS solutions and alarming overview</h3>
For those of you, who are not yet aware of the general data flow in OMS regarding solutions and alarming:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02-OMS-Solution.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02-OMS-Solution.png" alt="" class="alignnone wp-image-2045" width="599" height="414" /></a>

Everything is based upon the Log Analytics records stored in the OMS workspace. You can define queries by leveraging the powerful Azure Log Analytics query language. Based on these queries you can either create Alerts or specific vizualisation items called tiles. A tile could be a chart or a list for example. Multiple tile can form a custom OMS solution.

All of the dashboard tiles in my custom solution are based on specific queries against my custom log type <em>DirkBriClimateSensorDataV2_CL</em>:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_CustomRecord.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_CustomRecord.jpg" alt="" class="alignnone wp-image-1985" width="671" height="335" /></a>

Showing the health state of my devices is just a query that retrieves the HealthState property of the last record written per device:
<div>
<pre><span>DirkBriClimateSensorDataV2_CL </span>
<span>| </span><span>where</span><span> DeviceLocation_s </span><span>matches</span><span> </span><span>regex</span><span> </span><span>"Lager*"</span><span> </span>
<span>| </span><span>summarize</span><span> arg_max(TimeGenerated, *) </span><span>by</span><span> DeviceLocation_s </span>
<span>| </span><span>project</span><span> Location=DeviceLocation_s,HealthState=HealthState_s </span>
<span>| </span><span>order</span><span> </span><span>by</span><span> Location asc</span></pre>
</div>
And the last access time tile query is based on the <em>TimeGenerated</em> property of the latest record written by each device.

The line charts for temperature and humidity are based on a query like this:
<div>
<pre><span>DirkBriClimateSensorDataV2_CL </span>
<span>| </span><span>where</span><span> DeviceLocation_s </span><span>matches</span><span> </span><span>regex</span><span> </span><span>"Lager*"</span><span> </span><span>and</span><span> IsAlertMessage_b==</span><span>false</span><span> </span>
<span>| </span><span>summarize</span><span> avg(TemperatureValue_d) </span><span>by</span><span> DeviceLocation_s,bin(TimeGenerated, </span><span>1</span><span>h) </span>
<span>| </span><span>project</span><span> Location=DeviceLocation_s,Temperature=avg_TemperatureValue_d,TimeGenerated </span></pre>
</div>
&nbsp;
<h3>Alarming</h3>
One of my main objectives was to get an alert, when a threshold is exceeded, the device lost power or anything else unexpected happens. The logic behind this is covered within my "text message receive and process" runbook in Azure Automation. The runbook decides, if something is good (<em>HealthState = "OK"</em>), unknown (<em>someState = "Unknown"</em>) or an out-of-band alert (<em>IsAlertMessage = TRUE</em>).
In OMS I simply need to write the right query and configure an alert based on this query:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_Alert.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_Alert.jpg" alt="" class="alignnone wp-image-2015" width="787" height="392" /></a>

To get an alert, when a specific device in a location is unhealthy (<em>HealthState &lt;&gt; "OK"</em>), I query for <em>HealthState &lt;&gt; "OK"</em> within the last 24h. OMS will execute this query every 5 minutes and will raise an alert, if the query returns 1 or more results:
<pre>DirkBriClimateSensorDataV2_CL
| where DeviceLocation_s matches regex "Lager*"
| summarize  arg_max(TimeGenerated, *) by DeviceLocation_s
| where HealthState_s &lt;&gt; "OK"</pre>
The alert E-mail created by this alert looks like this:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_NotHealthyAlert.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_NotHealthyAlert.jpg" alt="" class="alignnone wp-image-2025" width="780" height="335" /></a>

The mail displays the query and the values of the matching result.

And of course: The dashboard will also display the current health state for easy detection:
<h3><a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_UnhealthyStatev2.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_UnhealthyStatev2.png" alt="" class="alignnone wp-image-2065" width="218" height="249" /></a></h3>
<h3></h3>
<h3></h3>
<h3>Costs of the solution</h3>
Ok, now its time to speak about costs. How much does this solution it cost?
Everything depends upon the amount of devices and how frequent you whish to collect data. The more frequent, the more text messages you need to send and pay for.
<ul>
 	<li><strong>One time costs
</strong>One time costs occur only for purchasing the devices. The DRH-3015 costs about<strong> 70 EUR</strong>, the RTU-5023 with antenna and power suply around<strong> 90 EUR</strong></li>
 	<li><strong>Re-occuring (monthly) costs</strong>
<ul>
 	<li>Twilio
You need a mobile phone number from Twilio. That will cost <strong>5 USD</strong> per Month. Every text message received will charge <strong>0,0075 USD/message</strong>. Every text message send will be charged <strong>0,085 USD/message</strong>.</li>
 	<li>Azure Automation
You can use the free version for this solution. 500 min per month should be enough -&gt; <strong>0 EUR</strong></li>
 	<li>OMS
You can use the free tier for this solution. 500 mb data and 7 days of storage should be enough -&gt; <strong>0 EUR</strong></li>
 	<li>Text messages from devices
These costs are hard to calculate, as they depend on how frequently you want to get status messages and/or trigger these. And it depends on your provider. I am using a provider that charges me <strong>4 EUR/month</strong> per device (SIM card) for 300 text messages. That would allow me to send 8 status messages every day (every 3h) and some buffer for out-of-band messages.</li>
</ul>
</li>
</ul>
I calculate with roughly <strong>6 EUR per month</strong> <strong>and device</strong> for in- and outbound text messages and <strong>5 USD</strong> for the Twilio number.

&nbsp;
<h3>Results realized?</h3>
So it is time to have a look at my objectives and what I had achieved with this solution:
<ul>
 	<li>Get an alert as quick as possible, when the room temperature fall out of a defined range
<span style="color: #339966">The device will send an out-of-band alert message to Twilio that gets translated into a record with HealthState &lt;&gt; "OK" and IsAlertMessage = TRUE. That will trigger an OMS alert.</span>
<span style="color: #339966">Additionally I could have created a query that checks, if the TempValue_d property is above/below a certain value.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>Get an alert as quick as possible, when there is a power outage in one of the locations
<span style="color: #339966">The device will send an out-of-band alert message to Twilio that gets translated into a record with HealthState &lt;&gt; "OK" and IsAlertMessage = TRUE. I also created a query that checks for devices not sending any data in a certain time frame. So either way I will get an alert, if a device dies.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>Get an overview (dashboard) of the current state of all locations from wherever I might be
<span style="color: #339966">See the dashboard above.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>Get an alert whenever one of the monitoring devices in a location dies (malfunction or other issue)
<span style="color: #339966">I also created a query that checks for devices not sending any data in a certain time frame. So either way I will get an alert, if a devices dies.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>[Optional] Track the temperature on a very basic level
<span style="color: #339966">See the dashboard above.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>[Optional] Track and alert the humidity in the room
<span style="color: #339966">See the dashboard above.</span>
<span style="color: #339966">Succeeded!!!</span></li>
 	<li>Spent as little time and as little money as possible
<span style="color: #ff9900">Well, that is an interesting question. I spend around 3 days total for testing and developing. From a cost perspective, it is within my personal limits. But to be honest: this solution does not scale well regarding costs. The more frequent I want to collect data from the devices, the more I have to pay...
</span></li>
</ul>
<h3>Summary</h3>
I really had some fun creating this solution. It is not perfect and I still have ideas for improvement. But hey, we are living in times of agile development, Dev-Ops and SCRUM, so this is my first working release after Sprint 1 :)

Using cloud based services like Azure Automation, OMS and Twilio can create powerful solutions even for guys like me, that are IT-Pro's and not Dev's. I wanted to show you a private use case for these technologies and I hope you liked it.

Feedback is always welcome and I might continue this series, once I implemented more feature. PowerBI integration is already on the horizon :)

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Monitoring temperature sensors in remote locations with Twilio, Azure Automation and Log Analytics - Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-2</link>
      <pubDate>Tue, 05 Sep 2017 16:48:36 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=1946</guid>
      <description><![CDATA[This is part two of my little three part series on how to monitor sensors in remote locations with...]]></description>
      <content:encoded><![CDATA[This is part two of my little three part series on how to monitor sensors in remote locations with Twilio, Azure Automation and OMS. It describes the overall solution architecture, some technical challenges I faced, solutions I found and lessons I learned.
For the background of this blog series, please read <a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-1/" rel="noopener noreferrer">part one</a>. If you just want to see the result, please go straight to <a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-3/" rel="noopener noreferrer">part three</a>.
<h3>Overview solution architecture</h3>
Based on the backgorund and ideas from part 1, this is an overview of the whole solution architecture that I want to create:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02-SolutionDrawing.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02-SolutionDrawing.png" alt="" class="alignnone wp-image-1955" width="733" height="533" /></a>
<h3>Handling text messages with Twilio</h3>
Let's start with the text message handling. You have to subscribe to the Twilio service to use it. Once you have a subscription, you have to buy a SMS capable mobile phone number. Once you've created a subscription, you will get an <strong>AccountSID</strong> and an <strong>AuthToken</strong> to authenticate against the Twilio service.
<h4>Sending text messages</h4>
Ok, how can we send a text message to an arbitrary receipient? Twilio provides a REST-API for this task and has a very good documentation of this REST-API. That makes translating this into PowerShell quiet easy:
<pre>function send-twiliosms
{
    param($RecipientNumber,
            $SMSText  )

    $TwilioSID = Get-AutomationVariable -Name "DirkBri-Twilio-AccountSID"
    $TwilioToken = Get-AutomationVariable -Name "DirkBri-Twilio-AuthToken"
    $TwilioNumber = Get-AutomationVariable -Name "DirkBri-Twilio-Number"

    $secureAuthToken = ConvertTo-SecureString $TwilioToken -AsPlainText -force 
    $TwilioCredential = New-Object System.Management.Automation.PSCredential($TwilioSID,$secureAuthToken)  

    $TwilioMessageBody = @{ 
       From = $TwilioNumber 
       To = $RecipientNumber 
       Body = $SMSText 
    } 

    $TwilioApiEndpoint= "https://api.twilio.com/2010-04-01/Accounts/$TwilioSID/Messages.json" 
    $Result = Invoke-RestMethod -Uri $TwilioApiEndpoint -Body $TwilioMessageBody  -Credential $TwilioCredential -Method "POST" -ContentType "application/x-www-form-urlencoded"  

    return $Result
}

$Result = send-twiliosms -RecipientNumber $Device -SMSText $dicDevicesToTrigger.item($Device)
write-host $Result</pre>
As you can see, I have stored the information of my number, the <em>AccountSID</em> and the <em>AuthToken</em> along with my OMS workspace information in an (encrypted) Azure Automation variable for better and safer usage.

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_AutomationVariables.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_AutomationVariables.png" alt="" class="alignnone wp-image-2035" width="586" height="182" /></a>
<h4>Receiving text messages</h4>
At the beginning of the project I was worried how I could receive the text messages send by the devices. Do I have to write some kind of polling mechanism? But then I checked the capabilities of my Twilio service and noticed this:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_TwilioWebhook.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_TwilioWebhook.jpg" alt="" class="alignnone wp-image-1965" width="825" height="85" />
</a>
Twilio can call a Webhook once a message arrives! Yessss! And Azure Automation runbooks can be triggered by a Webhook :)
So receiving text messages is the easiest part. Twilio will call the Azure runbook by invoking the Webhook and will commit the text message as a JSON structure within the Webhook. The RequestBody property contains the text message information:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_RequestBody.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_RequestBody.jpg" alt="" class="alignnone wp-image-1975" width="832" height="182" /></a>

&nbsp;
<h3>Azure Runbooks</h3>
I decided to create two runbooks:
<ul>
 	<li>One runbook that actively triggers the DRH-3015 devices to send their status message</li>
 	<li>One runbook to receive all text messages, parse them and create an OMS custom log record out of it</li>
</ul>
<h4>Trigger text message runbook</h4>
The trigger runbook consists mainly of the <em>send-twiliosms</em> function explained above. It gets triggered once per day (or as often as you want and would like to pay for the text messages) and sends a trigger to all DRH-3015 devices.
<h4>Receive and process text message runbook</h4>
This runbook is a bit more complex and performs these tasks:
<ul>
 	<li>Converts the URL encoded Webhook data from JSON to a PowerShell object with multiple properties like Sender, Message body, SMS ID etc.</li>
 	<li>Checks, if the sender is valid and approved. The runbook will not accept data from unknown numbers (devices) to prevent SPAM or malicious data.</li>
 	<li>Parses the different text message formats and transforms them into a single, standardized Hash table.
<strong>If for any reason the device sends a message that cannot be transformed properly (e.g. due to an unknown format), consider this as an alert and set the properties of the record accordingly.
</strong>This is an important fallback, in case my script has a flaw and cannot handle some specific kind of text message correctly.</li>
 	<li>Converts the Hash table into a JSON object and sends the JSON object to my OMS workspace using the REST API.
I use a custom OMS log called <em>DirkBriClimateSensorDataV2_CL</em>
You can find detailed information on how to send data to OMS via PowerShell and the REST-API <a target="_blank" href="https://blogs.technet.microsoft.com/germanageability/2016/10/12/testing-log-analytics-http-data-collector-api-limits-with-powershell/" rel="noopener noreferrer">here </a>and <a target="_blank" href="https://blogs.technet.microsoft.com/msoms/2016/08/30/http-data-collector-api-send-us-data-from-space-or-anywhere/" rel="noopener noreferrer">here</a></li>
</ul>
All these steps are relatively simple to realize with the incredible power of PowerShell. The most complicated part was designing the layout of the Hash Table, meaning what kind of properties I should send to OMS!
<h4>Properties for OMS custom log</h4>
<span style="color: #ff0000"><strong>Lesson learned</strong></span>
<span style="color: #ff0000"> One of the most important lessons I learned during this project was:</span>
<span style="color: #ff0000"> You NEED to know, what you want to achieve in OMS, BEFORE you create the custom log record!!! That might sound simple, but I guess I have created over 5 different custom logs, before it finally contained all data that I needed to build my OMS dashboards and create my alerts.
</span>
I ended up with this JSON data structure created by the runbook:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_JSON.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_JSON.jpg" alt="" class="alignnone wp-image-1976" width="715" height="255" /></a>

A brief explanation of the properties specified:
<ul>
 	<li><strong>HealthState</strong>
Allows me to show the overall health state of each device by showing the current (latest) HealthState value per device.</li>
 	<li><strong>HumidityValue,TemperatureValue,PowerValue</strong>
Number values that will allow me to draw charts in OMS</li>
 	<li><strong>HumidityState, TemperatureState, PowerState</strong>
State values that allow me to show the individual component state of each device.</li>
 	<li><strong>IsAlertMessage</strong>
Very important property that will be needed to create out-of-band alerts in OMS.</li>
 	<li><strong>DeviceType,PhoneNumer,Location</strong>
Content fields to identify the different devices.</li>
 	<li><strong>TwilioSMSMessageID, RunbookInvokeTime, TwilioSMSBody, RunbookScriptVersion</strong>
Additional information that will help troubleshooting in case of any issue.
<strong><span style="color: #ff0000">Lesson learned</span></strong>
<span style="color: #ff0000">This is a lesson I learned when I started creating SCOM Management Packs: You can never have too much data for debugging an troubleshooting purpose :). By including this data in the OMS log record I can easily track e.g. a text message throughout the whole process, determine the time difference between sending the data from Azure Automation to OMS and its availability for searching in Log Analytics and so on.</span></li>
</ul>
This is how the same JSON data will look like in Azure Log Analytics once transformed into a custom log record:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_CustomRecord.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-02_CustomRecord.jpg" alt="" class="alignnone wp-image-1985" width="679" height="339" /></a>

&nbsp;

Based on these properties I will hopefully be able to create the necessary dahsboards and alerts in OMS. Let's see this  in part three...]]></content:encoded>
    </item>
    <item>
      <title>Monitoring temperature sensors in remote locations with Twilio, Azure Automation and Log Analytics - Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/germanageability/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-1</link>
      <pubDate>Tue, 05 Sep 2017 16:48:15 GMT</pubDate>
      <dc:creator><![CDATA[Dirk Brinkmann]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.technet.microsoft.com/germanageability/?p=1896</guid>
      <description><![CDATA[This blog series is based on a private project and not customer related. But it might show you how...]]></description>
      <content:encoded><![CDATA[This blog series is based on a private project and not customer related. But it might show you how easy it is to solve real world problems with Azure services.
As a short teaser, this is my current custom OMS solution dashboard that I will explain throughout this blog series:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/SolutionDashboardv2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/SolutionDashboardv2.jpg" alt="" class="alignnone size-full wp-image-1925" width="1708" height="396" /></a>
<ul>
 	<li>Part 1 describes the initial situation and my decision criteria for the devices, tools and services I used to build the solution.</li>
 	<li><a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-2/" rel="noopener noreferrer">Part 2</a> describes the overall technical architecture, some technical details and some lessons learned</li>
 	<li><a target="_blank" href="http://blogs.technet.microsoft.com/germanageability/2017/09/05/monitoring-temperature-sensors-in-remote-locations-with-twilio-azure-automation-and-log-analytics-part-3/" rel="noopener noreferrer">Part 3</a> describes how I created the dashboard tiles and the alarmin based on the data I collected</li>
</ul>
If you are not interested in neither the background of my solution nor the technical details and just want to see the solution at work, please jump straight to part 3 :)
<h3>My initial situation</h3>
I have several remote locations (storage or cellar rooms) that I need to monitor regarding temperature, power loss/outage and humidity (optional).
<h4>Objectives for my solution</h4>
Precisely I wanted to achieve these objectives:
<ul>
 	<li>Get an alert as quick as possible, when the room temperature fall out of a defined range</li>
 	<li>Get an alert as quick as possible, when there is a power outage in one of the locations</li>
 	<li>Get an overview (dashboard) of the current state of all locations from wherever I might be</li>
 	<li>Get an alert whenever one of the monitoring devices in a location dies (malfunction or other issue)</li>
 	<li>[Optional] Track the temperature on a very basic level</li>
 	<li>[Optional] Track and alert the humidity in the room</li>
 	<li>Spent as little time and as little money as possible :)</li>
</ul>
<h4>Sensor devices</h4>
Some guys will say: this is a perfect job for a raspberry PI, isn’t it? Unfortunately, I don’t have a clue about the PI and I do not have any kind of internet or Wi-Fi connectivity at the remote location. Just some very basic 2G connectivity with rather poor reception (cellar, you know…).
Because I did not want to re-invent the wheel I searched for temperature monitoring sensors with GSM and SMS capabilities. Finally I came up with a device called <strong>DRH-3015</strong> Temperature Guard. It has an external temperature sensor that can be programmed and queried via SMS text messages:
<a href="https://msdnshared.blob.core.windows.net/media/2017/09/DRH3015.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/DRH3015.jpg" alt="" class="alignnone wp-image-1936" width="434" height="297" /></a>
I bought a couple of these devices. They work fine by sending text messages in case of a power outage (there is a battery backup module built in) or if the temperature falls out of the defined range. Unfortunately, this device cannot send status messages on a defined regular interval. You will always have to trigger the status message by sending a text message from your mobile phone. So for every measured value you have to pay twice: One trigger message and one message with the value as an answer!

I hoped that there were more intelligent devices availabe and after a while I found another device called KKMoon <strong>RTU5023 </strong>(available from a large US/international online retailer).
<a href="https://msdnshared.blob.core.windows.net/media/2017/09/RTU5023.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/RTU5023.jpg" alt="" class="alignnone wp-image-1935" width="431" height="229" /></a>
It provides some very nice features in addition to the DRH-3015:
<ul>
 	<li>External antenna connector for better 2G quality of reception</li>
 	<li>Allows to monitor temperature and humidity</li>
 	<li>Can send status messages (reports) on a scheduled base</li>
 	<li>You can call the device from an authorized mobile phone number. The device will not answer the call, but cancel it immediately so the call is free of charge. But it will trigger a status message sent to the caller. So querying the status of the device will cost you just one text message instead of two!</li>
</ul>
Currently I have three DRH-3015 and three RTU-5023 in place in four different locations.
<h3>Designing the solution</h3>
Now that I had my devices, how could I achieve my objectives? I quickly realized, that OMS Log Analytics is the perfect place for collecting all sensor information, creating nice dashboards and sending alerts based on the collected data. But how do I get the data into OMS?
Yes, I know. Would I have used a raspberry PI I would be able to send the sensor information straight up to OMS via our REST-API.
But as I just have devices sending text messages, I needed to find a way to:
<ul>
 	<li>Send text messages to the device automatically to trigger a status message (for the DRH-3015 devices)</li>
 	<li>Receive text messages and transfer them into a custom OMS log record (for out-of-band messages from both device types and periodic status messages from RTU-5023 devices)</li>
 	<li>Convert the text message into a standardized custom OMS log record</li>
</ul>
While playing a bit with the devices I also quickly noticed, that after I manage to receive these text messages automatically somehow, I have to transform and standardize them. And this can be challenging:
Unfortunately the devices have different kinds of formats for regular status messages and out-of-band alert messages. Even within the same type of device they can use different formats depending on the firmware used:

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_TextMessages.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/2017-09-03_TextMessages.png" alt="" class="alignnone wp-image-2027" width="436" height="281" /></a>

Receiving, parsing and extracting text is a perfect job for a PowerShell script! Running PowerShell scripts automatically in the cloud is offered by <strong>Azure Automation runbooks</strong>! So I will need at least one Azure Automation runbook.
But how do I trigger and receive text messages? By searching for the terms “<em>azure automation text message</em>” I quickly came up with a service called <a target="_blank" href="http://www.twilio.com" rel="noopener noreferrer">Twilio</a>. Twilio offers virtual mobile phone numbers in almost any country and a REST-API for sending and receiving text messages via this specific phone number.

Based on these thoughts and findings this is my plan for the technical solution and the upcoming next steps:
<ul>
 	<li>Trigger and receive text messages via Twilio</li>
 	<li>Get data from Twilio with an Azure Automation runbook</li>
 	<li>Send modified data to a custom log in OMS Log Analytics via an Azure Automation runbook</li>
 	<li>Built a dashboard based on the custom log records in OMS</li>
 	<li>Create E-Mail alerts based on the custom log records in OMS</li>
</ul>
I will describe the overall architecture and some technical details in part two of this series.]]></content:encoded>
    </item>
  </channel>
</rss>