{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/552","labels_url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/552/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/552/comments","events_url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/552/events","html_url":"https://github.com/Azure/azure-sdk-for-java/issues/552","id":115096276,"number":552,"title":"Calling StorageHelper.listStorageAccounts method generates error: \"SubscriptionNotFound\" even though subscription does exist","user":{"login":"jonbullock","id":1285247,"avatar_url":"https://avatars.githubusercontent.com/u/1285247?v=3","gravatar_id":"","url":"https://api.github.com/users/jonbullock","html_url":"https://github.com/jonbullock","followers_url":"https://api.github.com/users/jonbullock/followers","following_url":"https://api.github.com/users/jonbullock/following{/other_user}","gists_url":"https://api.github.com/users/jonbullock/gists{/gist_id}","starred_url":"https://api.github.com/users/jonbullock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonbullock/subscriptions","organizations_url":"https://api.github.com/users/jonbullock/orgs","repos_url":"https://api.github.com/users/jonbullock/repos","events_url":"https://api.github.com/users/jonbullock/events{/privacy}","received_events_url":"https://api.github.com/users/jonbullock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-sdk-for-java/labels/Team","name":"Team","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-04T16:48:59Z","updated_at":"2015-11-12T20:35:48Z","closed_at":null,"body":"I edited my local copy of ServicePrincipalExample with the relevant details and got it to run OK, however when I replaced the main code in ServicePrincipalExample with:\r\n\r\n````\r\n    \tConfiguration config = createConfiguration();\r\n    \tStorageManagementClient storageClient = StorageManagementService.create(config);\r\n    \tList<StorageAccount> storageAccounts = StorageHelper.listStorageAccounts(storageClient, null);\r\n    \tfor (StorageAccount storAcc : storageAccounts) {\r\n    \t\tSystem.out.println(storAcc.getName());\r\n    \t}\r\n````\r\nI always get the following stacktrace:\r\n\r\n````\r\nException in thread \"main\" java.util.concurrent.ExecutionException: com.microsoft.windowsazure.exception.ServiceException: SubscriptionNotFound: Subscription e4002xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx was not found.\r\n\tat java.util.concurrent.FutureTask.report(FutureTask.java:122)\r\n\tat java.util.concurrent.FutureTask.get(FutureTask.java:188)\r\n\tat com.microsoft.azure.utility.StorageHelper.listStorageAccounts(StorageHelper.java:186)\r\n\tat com.company.azure.auth.ServicePrincipalExample.main(ServicePrincipalExample.java:82)\r\nCaused by: com.microsoft.windowsazure.exception.ServiceException: SubscriptionNotFound: Subscription e4002xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx was not found.\r\n\tat com.microsoft.windowsazure.exception.ServiceException.createFromJson(ServiceException.java:290)\r\n\tat com.microsoft.azure.management.storage.StorageAccountOperationsImpl.list(StorageAccountOperationsImpl.java:1355)\r\n\tat com.microsoft.azure.management.storage.StorageAccountOperationsImpl$6.call(StorageAccountOperationsImpl.java:1284)\r\n\tat com.microsoft.azure.management.storage.StorageAccountOperationsImpl$6.call(StorageAccountOperationsImpl.java:1281)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:262)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n````\r\nThe subscription does exist and my service principal has been granted the contributor role for the subscription. I've even added 'Classic Storage Account Contributor' as well as 'Storage Account Contributor' roles but they have had no effect.\n<!---@tfsbridge:{\"tfsId\":5084225}-->"},"comment":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/comments/156226398","html_url":"https://github.com/Azure/azure-sdk-for-java/issues/552#issuecomment-156226398","issue_url":"https://api.github.com/repos/Azure/azure-sdk-for-java/issues/552","id":156226398,"user":{"login":"jonbullock","id":1285247,"avatar_url":"https://avatars.githubusercontent.com/u/1285247?v=3","gravatar_id":"","url":"https://api.github.com/users/jonbullock","html_url":"https://github.com/jonbullock","followers_url":"https://api.github.com/users/jonbullock/followers","following_url":"https://api.github.com/users/jonbullock/following{/other_user}","gists_url":"https://api.github.com/users/jonbullock/gists{/gist_id}","starred_url":"https://api.github.com/users/jonbullock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonbullock/subscriptions","organizations_url":"https://api.github.com/users/jonbullock/orgs","repos_url":"https://api.github.com/users/jonbullock/repos","events_url":"https://api.github.com/users/jonbullock/events{/privacy}","received_events_url":"https://api.github.com/users/jonbullock/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T20:35:48Z","updated_at":"2015-11-12T20:35:48Z","body":"@devigned they were created using the Azure Service Management (the old portal)."}}