{"id":20974922,"url":"https://github.com/usausa/template-azure-iot","last_synced_at":"2026-04-21T22:31:10.448Z","repository":{"id":44427923,"uuid":"512104428","full_name":"usausa/template-azure-iot","owner":"usausa","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-06T02:59:14.000Z","size":737,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-06T04:32:25.788Z","etag":null,"topics":["azure","azure-functions","azure-iot","azure-iothub","iot"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usausa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2022-07-09T05:45:04.000Z","updated_at":"2026-04-06T02:59:17.000Z","dependencies_parsed_at":"2024-02-06T05:25:36.076Z","dependency_job_id":"dc5e2f3b-a843-4bea-a8c5-a3858b3c4016","html_url":"https://github.com/usausa/template-azure-iot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usausa/template-azure-iot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usausa%2Ftemplate-azure-iot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usausa%2Ftemplate-azure-iot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usausa%2Ftemplate-azure-iot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usausa%2Ftemplate-azure-iot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usausa","download_url":"https://codeload.github.com/usausa/template-azure-iot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usausa%2Ftemplate-azure-iot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32112863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-functions","azure-iot","azure-iothub","iot"],"created_at":"2024-11-19T04:35:22.068Z","updated_at":"2026-04-21T22:31:10.423Z","avatar_url":"https://github.com/usausa.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Template project for Azure\n\n## 🍀 基本\n\n* Azure IoT Hub、Functions、App Serviceを使用したIoTプロジェクト構成の雛形を提供する\n\n## ✨ 実装機能\n\n* IoT HubからのイベントによるIoTHubTriggerでのデータベースアクセス\n* App Serviceによるデータベースの内容の表示\n\n![iot](./Document/IoT.drawio.svg)\n\n![App Service](./Document/AppService.png)\n\n## 🔨 設定\n\nサンプルの動作確認に必要な設定項目について。\n\n### データベース\n\n* 以下のテーブルを作成し、センサーデータのエントリを用意しておく\n\n```sql\nCREATE TABLE Sensor (\n    Id uniqueidentifier NOT NULL,\n    Value real NOT NULL,\n    Timestamp datetimeoffset(3) NOT NULL,\n    CONSTRAINT PK_Sensor PRIMARY KEY CLUSTERED (Id)\n)\n```\n\n### Functions\n\n* 関数アプリの構成で以下の値を設定しておく\n\n| 名前 | 値\n|:-|:-|\n|HubConnectionString|Endpoint=...(IoT Hubの組み込みのエンドポイントの値)|\n|SQLConnectionString|Server=...(SQL Databaseの接続文字列の値)|\n\n### App Service\n\n* 関数アプリの構成で以下の値を設定しておく\n\n| 名前 | 値\n|:-|:-|\n|ConnectionStrings__SQL|Server=...(SQL Databaseの接続文字列の値))|\n\n### Deviceクライアント\n\n* Microsoft.Azure.Devices.Clientを使用したクライアントサンプルを動作させる場合、ソースの以下の部分を変更する\n\n```csharp\npublic static class Program\n{\n    // IoT Hubのデバイスの接続文字列\n    private const string ConnectionString =\n        \"HostName={hub}.azure-devices.net;DeviceId={deviceId};SharedAccessKey={ssa}\";\n\n    // データベースに登録したデバイスのID\n    private static readonly Guid Id = Guid.Parse(\"00000000-0000-0000-0000-000000000000\");\n```\n\n### MQTTクライアント\n\n* MQTTを直接使用するクライアントサンプルを動作させる場合、ソースの以下の部分を変更する\n\n```csharp\npublic static class Program\n{\n    // IoT Hubのホスト名\n    private const string Server = \"{name}.azure-devices.net\";\n    // IoT Hubに登録したデバイスID\n    private const string ClientId = \"{deviceId}\";\n    private const string Username = $\"{Server}/{ClientId}/api-version=2021-04-12\";\n    // az iot hub generate-sas-token 等で作成したSASトークン\n    private const string Password = \"{SharedAccessSignature ...}\";\n    private const string TopicD2C = $\"devices/{ClientId}/messages/events/\";\n\n    // データベースに登録したデバイスのID\n    private static readonly Guid Id = Guid.Parse(\"00000000-0000-0000-0000-000000000000\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusausa%2Ftemplate-azure-iot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusausa%2Ftemplate-azure-iot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusausa%2Ftemplate-azure-iot/lists"}