{"id":384,"date":"2019-03-20T14:22:26","date_gmt":"2019-03-20T13:22:26","guid":{"rendered":"https:\/\/azure.teamprojects.de\/?page_id=384"},"modified":"2019-03-21T13:45:54","modified_gmt":"2019-03-21T12:45:54","slug":"fehlerbericht-azure-verbindung-fehlgeschlagen","status":"publish","type":"page","link":"https:\/\/azure.teamprojects.de\/?page_id=384","title":{"rendered":"Philips Hue Fehlerbericht"},"content":{"rendered":"\n<h4><strong>Aufgetretene Probleme:<\/strong><\/h4>\n\n\n\n<p>Das eigentliche Ziel war dass, sobald die Hue Lampe eingeschaltet w\u00fcrde, eine Information an die Azure Cloud gesendet werden sollte. Da aber meine Hue Lampe nur als Empf\u00e4nger arbeitete habe ich mir eine alternative Vorgehensweise ausgedacht. Ich bin wie im Folgenden beschrieben vorgegangen.<br><br>Im Code in Abbildung 12 habe ich versucht, nachdem die Lampe ein-\/ausgeschaltet wurde in der If-Anwesiung durch ein <em>Add-StorageTableRow-Befehl in Zeile 34 und 43 <\/em>einen String (Text) mit dem Status und der Uhrzeit der Lampe an die Azure table (Tabelle) zu versenden. Das hat leider nicht geklappt wie ich wollte, weil Azure Powershell keinen String akzeptiert hat. So konnte ich keinen String an Azure versenden und bin auch durch Recherchieren nicht weitergekommen.<br><\/p>\n\n\n\n<h4><strong>Was ich in Erfahrung gebracht habe:<\/strong><\/h4>\n\n\n\n<p>Ich habe im Internet nur Informationen gefunden, die erkl\u00e4ren, wie Speicherkonten in andere Speicherkonten kopiert werden. <br>Bei meinem ersten Versuch habe ich versucht, einen String  in ein Speicherkonto zu speichern.  <br>Powershell hat als Fehler angegeben, dass kein String direkt in Azures Speicherkonto gespeichert werden kann. <br>Daraufhin habe ich eine Datei erzeugt, und diese in einen String gespeichert. Auch das war erfolglos. <br><\/p>\n\n\n\n<p>Im Folgenden beschreibe ich, wie ich bis zur Problematischen Stelle gelangt bin. Wer sich damit etwas genauer besch\u00e4ftigen m\u00f6chte, kann das Tutorial durchgehen.<\/p>\n\n\n\n<h2><strong>Dateien \u00fcber Azure table (Tabelle) speichern<\/strong><\/h2>\n\n\n\n<p>Rufen Sie die Azure Webseite auf.<br><a href=\"https:\/\/portal.azure.com\/#@testalexaoutlook.onmicrosoft.com\/dashboard\/private\/26d2ffcf-55ef-4b7a-b35e-a140daa8e00d\">https:\/\/portal.azure.com\/#@testalexaoutlook.onmicrosoft.com\/dashboard\/private\/26d2ffcf-55ef-4b7a-b35e-a140daa8e00d<\/a><\/p>\n\n\n\n<p>Unter &#8222;Resource groups&#8220; eine Ressource aussuchen oder hinzuf\u00fcgen (\u201eadd\u201c).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"536\" height=\"631\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-17.png\" alt=\"\" class=\"wp-image-385\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-17.png 536w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-17-255x300.png 255w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><figcaption>Abbildung 1<\/figcaption><\/figure>\n\n\n\n<p>Wenn Sie eine Ressource aussuchen und darauf klicken werden Sie anschlie\u00dfend nochmals durch &#8222;Add&#8220; weitergeleitet.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"721\" height=\"339\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-18.png\" alt=\"\" class=\"wp-image-386\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-18.png 721w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-18-300x141.png 300w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><figcaption>Abbildung 2<\/figcaption><\/figure>\n\n\n\n<p>&#8222;Storage account&#8220; in die Suche eingeben und auf &#8222;Storage account&#8220; klicken. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"525\" height=\"586\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-19.png\" alt=\"\" class=\"wp-image-388\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-19.png 525w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-19-269x300.png 269w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><figcaption>Abbildung 3<\/figcaption><\/figure>\n\n\n\n<p> Weiter mit \u201ecreate\u201c (Erstellen).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"657\" height=\"346\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-20.png\" alt=\"\" class=\"wp-image-389\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-20.png 657w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-20-300x158.png 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><figcaption>Abbildung 4<\/figcaption><\/figure>\n\n\n\n<p>Sinnvollen Namen angeben und mit \u201eReview + create\u201c ausf\u00fchren.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"891\" height=\"662\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-21.png\" alt=\"\" class=\"wp-image-390\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-21.png 891w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-21-300x223.png 300w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-21-768x571.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>Abbildung 5<\/figcaption><\/figure>\n\n\n\n<p>Mit \u201ecreate\u201c die endg\u00fcltigen Speicherkontoerstellung  starten.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"685\" height=\"616\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-22.png\" alt=\"\" class=\"wp-image-391\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-22.png 685w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-22-300x270.png 300w\" sizes=\"(max-width: 685px) 100vw, 685px\" \/><figcaption>Abbildung 6<\/figcaption><\/figure>\n\n\n\n<p>Table Erzeugung im Storage account durch klicken auf &#8222;Tables&#8220;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"873\" height=\"749\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-23.png\" alt=\"\" class=\"wp-image-392\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-23.png 873w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-23-300x257.png 300w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-23-768x659.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>Abbildung 7<\/figcaption><\/figure>\n\n\n\n<p> Weiter auf \u201eTable\u201c.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"398\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-24.png\" alt=\"\" class=\"wp-image-393\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-24.png 945w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-24-300x126.png 300w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-24-768x323.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>Abbildung 8<\/figcaption><\/figure>\n\n\n\n<p>Namen vergeben und mit \u201eOK\u201c best\u00e4tigen.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"452\" height=\"428\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-25.png\" alt=\"\" class=\"wp-image-394\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-25.png 452w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-25-300x284.png 300w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><figcaption>Abbildung 9<\/figcaption><\/figure>\n\n\n\n<p>SAS und connection string generieren durch klicken von &#8222;Generate SAS and connection string&#8220;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"735\" height=\"814\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-27.png\" alt=\"\" class=\"wp-image-396\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-27.png 735w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-27-271x300.png 271w\" sizes=\"(max-width: 735px) 100vw, 735px\" \/><figcaption>Abbildung 10<\/figcaption><\/figure>\n\n\n\n<p>Den SAS token kopieren.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"207\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-28.png\" alt=\"\" class=\"wp-image-397\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-28.png 945w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-28-300x66.png 300w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Unbenannt-28-768x168.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>Abbildung 11<\/figcaption><\/figure>\n\n\n\n<p>Setzen Sie alle Ihre Daten hier ein.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Schritt 1, Variablen definieren\n$resourceGroup = '&lt;Enter Resource Group>'\n$storageAccountName = '&lt;Enter Storage Account Here>'    $tableName = '&lt;Enter Table Name Here>'    \n$sasToken = '&lt;Enter SAS Token Here>'   \n$dateTime = get-date   \n$partitionKey = 'Svr1PerfData'   \n\n# Schritt 2, verbindet sich mit dem Azure table Storage Account\n$storageCtx = New-AzureStorageContext -StorageAccountName $storageAccountName -SasToken $sasToken\n$table = Get-AzureStorageTable -Name $tableName -Context $storageCtx<\/code><\/pre>\n\n\n\n<p>Einige Modifikationen am Code.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"795\" height=\"515\" src=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Bildschirmfoto-2019-03-21-um-01.56.34.png\" alt=\"\" class=\"wp-image-535\" srcset=\"https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Bildschirmfoto-2019-03-21-um-01.56.34.png 795w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Bildschirmfoto-2019-03-21-um-01.56.34-300x194.png 300w, https:\/\/azure.teamprojects.de\/wp-content\/uploads\/2019\/03\/Bildschirmfoto-2019-03-21-um-01.56.34-768x498.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>Abbildung 12<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Schritt 1, Variablen definieren\n$resourceGroup = '&lt;Enter Resource Group>'\n$storageAccountName = '&lt;Enter Storage Account Here>'    $tableName = '&lt;Enter Table Name Here>'    \n$sasToken = '&lt;Enter SAS Token Here>'   \n$dateTime = get-date   \n$partitionKey = 'Svr1PerfData'     \n\n# Schritt 2, verbindet sich mit dem Azure table Storage Account\n$storageCtx = New-AzureStorageContext -StorageAccountName $storageAccountName -SasToken $sasToken\n$table = Get-AzureStorageTable -Name $tableName -Context $storageCtx\n\n# Hue Bridge\n$hueBridge = \"http:\/\/&lt;Ihre IP-Adresse>\/api\/\" \n# Lampe die gesteuert werden soll \n$lightNumber = &lt;ID Ihrer Lampe> \n# Benutzername\n$username = '&lt;Benutzername den die Hue bridge Ihnen geben hat>'\n\n$result = Invoke-RestMethod -Method Get -Uri \"$($hueBridge)\/$($username)\/lights\"\n$currentState = $result.$lightNumber | select state\n\nIf ($currentState.state.on.Equals($false)){\n    $body = @{\"on\"=$true} | ConvertTo-Json\n    write-host \"Light 2 is OFF, turning it ON\"\n\n       Add-StorageTableRow -table $table -partitionKey $partitionKey -rowKey ([guid]::NewGuid().tostring()) -property @{\n        'Zeit' = $dateTime.ToString(\"yyyymmdd:hhmmss\")\n        'Status' = str \"Light 2 is OFF, turning it ON\"\n    } | Out-Null  \n\n} else {\n    $body = @{\"on\"=$false} | ConvertTo-Json\n    write-host \"Light 2 is ON, turning it OFF\"\n\n       Add-StorageTableRow -table $table -partitionKey $partitionKey -rowKey ([guid]::NewGuid().tostring()) -property @{\n        'Zeit' = $dateTime.ToString(\"yyyymmdd:hhmmss\")\n        'Status' = str  \"Light 2 is ON, turning it OFF\"\n    } | Out-Null\n}\n\n$result = Invoke-RestMethod -Method PUT -Uri \"$($hueBridge)\/$($username)\/lights\/$($lightNumber)\/state\" -Body $body\n$result\n\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Aufgetretene Probleme: Das eigentliche Ziel war dass, sobald die Hue Lampe eingeschaltet w\u00fcrde, eine Information an die Azure Cloud gesendet werden sollte. Da aber meine Hue Lampe nur als Empf\u00e4nger arbeitete habe ich mir eine alternative Vorgehensweise ausgedacht. Ich bin wie im Folgenden beschrieben vorgegangen. Im Code in Abbildung 12 habe ich versucht, nachdem die &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/azure.teamprojects.de\/?page_id=384\" class=\"more-link\"><span class=\"screen-reader-text\">\u201ePhilips Hue Fehlerbericht\u201c<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":100,"featured_media":0,"parent":585,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/pages\/384"}],"collection":[{"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=384"}],"version-history":[{"count":44,"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/pages\/384\/revisions"}],"predecessor-version":[{"id":643,"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/pages\/384\/revisions\/643"}],"up":[{"embeddable":true,"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=\/wp\/v2\/pages\/585"}],"wp:attachment":[{"href":"https:\/\/azure.teamprojects.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}