{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-powershell/issues/3699","repository_url":"https://api.github.com/repos/Azure/azure-powershell","labels_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3699/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3699/comments","events_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3699/events","html_url":"https://github.com/Azure/azure-powershell/issues/3699","id":218361218,"number":3699,"title":"Get-AzureRmIotHubConnectionString returns bad/incorrect connection string","user":{"login":"Pradebban","id":13054214,"avatar_url":"https://avatars0.githubusercontent.com/u/13054214?v=3","gravatar_id":"","url":"https://api.github.com/users/Pradebban","html_url":"https://github.com/Pradebban","followers_url":"https://api.github.com/users/Pradebban/followers","following_url":"https://api.github.com/users/Pradebban/following{/other_user}","gists_url":"https://api.github.com/users/Pradebban/gists{/gist_id}","starred_url":"https://api.github.com/users/Pradebban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pradebban/subscriptions","organizations_url":"https://api.github.com/users/Pradebban/orgs","repos_url":"https://api.github.com/users/Pradebban/repos","events_url":"https://api.github.com/users/Pradebban/events{/privacy}","received_events_url":"https://api.github.com/users/Pradebban/received_events","type":"User","site_admin":false},"labels":[{"id":497186812,"url":"https://api.github.com/repos/Azure/azure-powershell/labels/IoTHub","name":"IoTHub","color":"DDDDDD","default":false}],"state":"open","locked":false,"assignee":{"login":"rkmanda","id":16844618,"avatar_url":"https://avatars3.githubusercontent.com/u/16844618?v=3","gravatar_id":"","url":"https://api.github.com/users/rkmanda","html_url":"https://github.com/rkmanda","followers_url":"https://api.github.com/users/rkmanda/followers","following_url":"https://api.github.com/users/rkmanda/following{/other_user}","gists_url":"https://api.github.com/users/rkmanda/gists{/gist_id}","starred_url":"https://api.github.com/users/rkmanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkmanda/subscriptions","organizations_url":"https://api.github.com/users/rkmanda/orgs","repos_url":"https://api.github.com/users/rkmanda/repos","events_url":"https://api.github.com/users/rkmanda/events{/privacy}","received_events_url":"https://api.github.com/users/rkmanda/received_events","type":"User","site_admin":false},"assignees":[{"login":"rkmanda","id":16844618,"avatar_url":"https://avatars3.githubusercontent.com/u/16844618?v=3","gravatar_id":"","url":"https://api.github.com/users/rkmanda","html_url":"https://github.com/rkmanda","followers_url":"https://api.github.com/users/rkmanda/followers","following_url":"https://api.github.com/users/rkmanda/following{/other_user}","gists_url":"https://api.github.com/users/rkmanda/gists{/gist_id}","starred_url":"https://api.github.com/users/rkmanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkmanda/subscriptions","organizations_url":"https://api.github.com/users/rkmanda/orgs","repos_url":"https://api.github.com/users/rkmanda/repos","events_url":"https://api.github.com/users/rkmanda/events{/privacy}","received_events_url":"https://api.github.com/users/rkmanda/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2017-03-30T23:57:13Z","updated_at":"2017-04-13T17:15:50Z","closed_at":null,"body":"### Cmdlet(s)\r\n\r\nGet-AzureRmIotHubConnectionString\r\n\r\n### PowerShell Version\r\n\r\n5.0.10586.117\r\n\r\n### Module Version\r\n\r\n2.7.0\r\n\r\n### OS Version\r\n\r\n10.0.10586.117\r\n\r\n### Description\r\n\r\nGet-AzureRmIotHubConnectionString -ResourceGroupName hidden -Name hidden -KeyName service\r\n\r\n**Returns primary connection string which is incorrect**\r\nHostName=hidden.azure-devices.net;**ShareAccessKeyName**=service;SharedAccessKey=axhiddenkfKY/d...\r\n\r\nInstead of **SharedAccessKeyName**, it returns **_ShareAccessKeyName_** (missing \"D\")\r\n\r\n### Debug Output\r\n\r\nGet-AzureRmIotHubConnectionString -ResourceGroupName hidden -Name hidden -KeyName service\r\n\r\nDEBUG: 7:49:46 PM - using account id 'Pradebban@hidden.onmicrosoft.com'...\r\nDEBUG: [Common.Authentication]: Authenticating using Account: 'Pradebban@hidden.onmicrosoft.com', environment:\r\n'AzureCloud', tenant: 'c990bb7a-hidden51b1041c0'\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46:  - TokenCache: Deserialized 2 items to token cache.\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3da664-53a9-4224-b112-16bd3ecc2835 - AcquireTokenHandlerBase: === Token Acquisition\r\nstarted:\r\n Authority: https://login.microsoftonline.com/c990bb7a1041c0/\r\n Resource: https://management.core.windows.net/\r\n ClientId: 1950a258945fc2\r\n CacheType: Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache (2 items)\r\n Authentication Target: User\r\n\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3da664hidden-16bd3ecc2835 - TokenCache: Looking up cache for a token...\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3da6hidden6bd3ecc2835 - TokenCache: An item matching the requested resource\r\nwas found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3dahiddencc2835 - TokenCache: 51.1192257683333 minutes left until\r\ntoken in cache expires\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3da66hidden3ecc2835 - TokenCache: A matching item (access token or refresh\r\n token or both) was found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 5e3da664-53hidden3ecc2835 - AcquireTokenHandlerBase: === Token Acquisition\r\nfinished successfully. An access token was retuned:\r\n Access Token Hash: m+7Ei+gbv7hiddenT0KOvKNtPc=\r\n Refresh Token Hash: 9l2okiF9fThiddenxBXZ+M0o04=\r\n Expiration Time: 03/31/2017 00:40:53 +00:00\r\n User Hash: YaUHf8ySNhiddenNeIHQAKMhXg=\r\n\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46:  - TokenCache: Serializing token cache with 2 items.\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: d6e54d52-aa5f-400d-b84a-13caaba6ecd1 - AcquireTokenHandlerBase: === Token Acquisition\r\nstarted:\r\n Authority: https://login.microsoftonline.com/c990bb7hidden041c0/\r\n Resource: https://management.core.windows.net/\r\n ClientId: 1950a2hidden95945fc2\r\n CacheType: Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache (2 items)\r\n Authentication Target: User\r\n\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: d6e54d5hiddenaba6ecd1 - TokenCache: Looking up cache for a token...\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: d6e54dhiddenaaba6ecd1 - TokenCache: An item matching the requested resource\r\nwas found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: d6e54hiddenaba6ecd1 - TokenCache: 51.1192090866667 minutes left until\r\ntoken in cache expires\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: d6e54d52hiddenaba6ecd1 - TokenCache: A matching item (access token or refresh\r\n token or both) was found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: d6e5hiddencaaba6ecd1 - AcquireTokenHandlerBase: === Token Acquisition\r\nfinished successfully. An access token was retuned:\r\n Access Token Hash: m+7Ei+gbv7SVTYhiddenKOvKNtPc=\r\n Refresh Token Hash: 9l2okiF9fhiddenQ3ARItDMxBXZ+M0o04=\r\n Expiration Time: 03/31/2017 00:40:53 +00:00\r\n User Hash: YaUHf8ySNCwtRhiddenIHQAKMhXg=\r\n\r\nDEBUG: ============================ HTTP REQUEST ============================\r\n\r\nHTTP Method:\r\nGET\r\n\r\nAbsolute Uri:\r\nhttps://management.azure.com/subscriptions/629515hidden1899fdce2/resourceGroups/hidden/provid\r\ners/Microsoft.Devices/IotHubs/hidden?api-version=2016-02-03\r\n\r\nHeaders:\r\nx-ms-client-request-id        : c40e437b-hidden35fa61ca0\r\naccept-language               : en-US\r\n\r\nBody:\r\n\r\n\r\nDEBUG: ============================ HTTP RESPONSE ============================\r\n\r\nStatus Code:\r\nOK\r\n\r\nHeaders:\r\nPragma                        : no-cache\r\nx-ms-ratelimit-remaining-subscription-reads: 14996\r\nx-ms-request-id               : afed773f-hidden31d66b769b\r\nx-ms-correlation-request-id   : afed773fhidden4731d66b769b\r\nx-ms-routing-request-id       : SOUTHCENTRALUS:20170330T234947Z:afed773fhiddend66b769b\r\nStrict-Transport-Security     : max-age=31536000; includeSubDomains\r\nCache-Control                 : no-cache\r\nDate                          : Thu, 30 Mar 2017 23:49:46 GMT\r\nServer                        : Microsoft-HTTPAPI/2.0\r\n\r\nBody:\r\n{\r\n  \"id\":\r\n\"/subscriptions/629515ahidden9fdce2/resourceGroups/hidden/providers/Microsoft.Devices/IotHu\r\nbs/hidden\",\r\n  \"name\": \"hidden\",\r\n  \"type\": \"Microsoft.Devices/IotHubs\",\r\n  \"location\": \"EastUS\",\r\n  \"tags\": {\r\n    \"Environment\": \"hidden\"\r\n  },\r\n  \"subscriptionid\": \"62951hiddendce2\",\r\n  \"resourcegroup\": \"mhiddenm\",\r\n  \"etag\": \"AAAAAADIe7I=\",\r\n  \"properties\": {\r\n    \"state\": \"Active\",\r\n    \"provisioningState\": \"Succeeded\",\r\n    \"ipFilterRules\": [],\r\n    \"hostName\": \"mhiddenrm.azure-devices.net\",\r\n    \"eventHubEndpoints\": {\r\n      \"events\": {\r\n        \"retentionTimeInDays\": 1,\r\n        \"partitionCount\": 32,\r\n        \"partitionIds\": [\r\n          \"0\",\r\n          \"1\",\r\n          \"2\",\r\n          \"3\",\r\n          \"4\",\r\n          \"5\",\r\n          \"6\",\r\n          \"7\",\r\n          \"8\",\r\n          \"9\",\r\n          \"10\",\r\n          \"11\",\r\n          \"12\",\r\n          \"13\",\r\n          \"14\",\r\n          \"15\",\r\n          \"16\",\r\n          \"17\",\r\n          \"18\",\r\n          \"19\",\r\n          \"20\",\r\n          \"21\",\r\n          \"22\",\r\n          \"23\",\r\n          \"24\",\r\n          \"25\",\r\n          \"26\",\r\n          \"27\",\r\n          \"28\",\r\n          \"29\",\r\n          \"30\",\r\n          \"31\"\r\n        ],\r\n        \"path\": \"mhiddenbrm\",\r\n        \"endpoint\": \"sb://iothub-ns-hidden-62f7bed93d.servicebus.windows.net/\"\r\n      },\r\n      \"operationsMonitoringEvents\": {\r\n        \"retentionTimeInDays\": 1,\r\n        \"partitionCount\": 32,\r\n        \"partitionIds\": [\r\n          \"0\",\r\n          \"1\",\r\n          \"2\",\r\n          \"3\",\r\n          \"4\",\r\n          \"5\",\r\n          \"6\",\r\n          \"7\",\r\n          \"8\",\r\n          \"9\",\r\n          \"10\",\r\n          \"11\",\r\n          \"12\",\r\n          \"13\",\r\n          \"14\",\r\n          \"15\",\r\n          \"16\",\r\n          \"17\",\r\n          \"18\",\r\n          \"19\",\r\n          \"20\",\r\n          \"21\",\r\n          \"22\",\r\n          \"23\",\r\n          \"24\",\r\n          \"25\",\r\n          \"26\",\r\n          \"27\",\r\n          \"28\",\r\n          \"29\",\r\n          \"30\",\r\n          \"31\"\r\n        ],\r\n        \"path\": \"middennitoring\",\r\n        \"endpoint\": \"sb://iothub-ns-mhidden3d.servicebus.windows.net/\"\r\n      }\r\n    },\r\n    \"routing\": {\r\n      \"endpoints\": {\r\n        \"serviceBusQueues\": [],\r\n        \"serviceBusTopics\": [],\r\n        \"eventHubs\": []\r\n      },\r\n      \"routes\": [],\r\n      \"fallbackRoute\": {\r\n        \"name\": \"$fallback\",\r\n        \"source\": \"DeviceMessages\",\r\n        \"condition\": \"true\",\r\n        \"endpointNames\": [\r\n          \"events\"\r\n        ],\r\n        \"isEnabled\": true\r\n      }\r\n    },\r\n    \"storageEndpoints\": {\r\n      \"$default\": {\r\n        \"sasTtlAsIso8601\": \"PT1H\",\r\n        \"connectionString\": \"\",\r\n        \"containerName\": \"\"\r\n      }\r\n    },\r\n    \"messagingEndpoints\": {\r\n      \"fileNotifications\": {\r\n        \"lockDurationAsIso8601\": \"PT1M\",\r\n        \"ttlAsIso8601\": \"PT1H\",\r\n        \"maxDeliveryCount\": 10\r\n      }\r\n    },\r\n    \"enableFileUploadNotifications\": false,\r\n    \"cloudToDevice\": {\r\n      \"maxDeliveryCount\": 10,\r\n      \"defaultTtlAsIso8601\": \"PT1H\",\r\n      \"feedback\": {\r\n        \"lockDurationAsIso8601\": \"PT1M\",\r\n        \"ttlAsIso8601\": \"PT1H\",\r\n        \"maxDeliveryCount\": 10\r\n      }\r\n    },\r\n    \"operationsMonitoringProperties\": {\r\n      \"events\": {\r\n        \"None\": \"None\",\r\n        \"Connections\": \"None\",\r\n        \"DeviceTelemetry\": \"None\",\r\n        \"C2DCommands\": \"None\",\r\n        \"DeviceIdentityOperations\": \"None\",\r\n        \"FileUploadOperations\": \"None\",\r\n        \"Routes\": \"None\"\r\n      }\r\n    },\r\n    \"features\": \"None\",\r\n    \"generationNumber\": 0\r\n  },\r\n  \"sku\": {\r\n    \"name\": \"S2\",\r\n    \"tier\": \"Standard\",\r\n    \"capacity\": 1\r\n  }\r\n}\r\n\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 4dd0a51b-0ffc-431a-87c7-aab246c483f2 - AcquireTokenHandlerBase: === Token Acquisition\r\nstarted:\r\n Authority: https://login.microsoftonline.com/c990bbhidden-9c07fb1041c0/\r\n Resource: https://management.core.windows.net/\r\n ClientId: 1950a258-22hidden45fc2\r\n CacheType: Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache (2 items)\r\n Authentication Target: User\r\n\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: 4dd0a5hiddenab246c483f2 - TokenCache: Looking up cache for a token...\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 4dd0a5hiddenaab246c483f2 - TokenCache: An item matching the requested resource\r\nwas found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :\r\nDEBUG: 03/30/2017 23:49:46: 4dd0a51b-hiddenaab246c483f2 - TokenCache: 51.1071455666667 minutes left until\r\ntoken in cache expires\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 4dd0a51hidden-aab246c483f2 - TokenCache: A matching item (access token or refresh\r\n token or both) was found in the cache\r\nDEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :\r\nDEBUG: 03/30/2017 23:49:46: 4ddhidden-87chidden46c483f2 - AcquireTokenHandlerBase: === Token Acquisition\r\nfinished successfully. An access token was retuned:\r\n Access Token Hash: m+7Ei+gbv7SVThiddens4QT0KOvKNtPc=\r\n Refresh Token Hash: 9l2okiF9fTzMhiddenZ+M0o04=\r\n Expiration Time: 03/31/2017 00:40:53 +00:00\r\n User Hash: YaUHf8ySNhiddeneIHQAKMhXg=\r\n\r\nDEBUG: ============================ HTTP REQUEST ============================\r\n\r\nHTTP Method:\r\nPOST\r\n\r\nAbsolute Uri:\r\nhttps://management.azure.com/subscriptions/629hiddenf36-0b01899fdce2/resourceGroups/hidden/provid\r\ners/Microsoft.Devices/IotHubs/hidden/IotHubKeys/service/listkeys?api-version=2016-02-03\r\n\r\nHeaders:\r\nx-ms-client-request-id        : b649adc7hidden6dd1c7b42\r\naccept-language               : en-US\r\n\r\nBody:\r\n\r\n\r\nDEBUG: ============================ HTTP RESPONSE ============================\r\n\r\nStatus Code:\r\nOK\r\n\r\nHeaders:\r\nPragma                        : no-cache\r\nx-ms-ratelimit-remaining-subscription-writes: 1199\r\nx-ms-request-id               : 662f0fd9hiddenbd76c1775825\r\nx-ms-correlation-request-id   : 66hidden0-bd76c1775825\r\nx-ms-routing-request-id       : SOUTHCENTRALUS:20170330T234947Z:662f0fd9-2a9hidden775825\r\nStrict-Transport-Security     : max-age=31536000; includeSubDomains\r\nCache-Control                 : no-cache\r\nDate                          : Thu, 30 Mar 2017 23:49:46 GMT\r\nServer                        : Microsoft-HTTPAPI/2.0\r\n\r\nBody:\r\n{\r\n  \"keyName\": \"service\",\r\n  \"primaryKey\": \"axZnhidden1MNyiSk7k=\",\r\n  \"secondaryKey\": \"2iTjl0hiddenV1lRwkA=\",\r\n  \"rights\": \"ServiceConnect\"\r\n}\r\n\r\n\r\nDEBUG: 7:49:47 PM - GetAzureRmIotHubConnectionString end processing.\r\nDEBUG: 7:49:47 PM - GetAzureRmIotHubConnectionString end processing.\r\nKeyName PrimaryConnectionString\r\n------- -----------------------\r\nservice HostName=hidden.azure-devices.net;ShareAccessKeyName=service;SharedAccessKey=axZhiddenkfKY/d...\r\n\r\n\r\n### Script/Steps for Reproduction\r\n\r\nGet-AzureRmIotHubConnectionString -ResourceGroupName hidden -Name hidden -KeyName service\r\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-powershell/issues/comments/293964741","html_url":"https://github.com/Azure/azure-powershell/issues/3699#issuecomment-293964741","issue_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3699","id":293964741,"user":{"login":"markcowl","id":1054056,"avatar_url":"https://avatars2.githubusercontent.com/u/1054056?v=3","gravatar_id":"","url":"https://api.github.com/users/markcowl","html_url":"https://github.com/markcowl","followers_url":"https://api.github.com/users/markcowl/followers","following_url":"https://api.github.com/users/markcowl/following{/other_user}","gists_url":"https://api.github.com/users/markcowl/gists{/gist_id}","starred_url":"https://api.github.com/users/markcowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markcowl/subscriptions","organizations_url":"https://api.github.com/users/markcowl/orgs","repos_url":"https://api.github.com/users/markcowl/repos","events_url":"https://api.github.com/users/markcowl/events{/privacy}","received_events_url":"https://api.github.com/users/markcowl/received_events","type":"User","site_admin":false},"created_at":"2017-04-13T17:15:50Z","updated_at":"2017-04-13T17:15:50Z","body":"@rkmanda, please reply with a review on the fix - we cannot merge this without approval from the iothub team"}}
{"actor":{"display_login":"markcowl"}}