Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzStorageAccount does not work for AzureUSGovernment regions #8892

Closed
J0R3D1N opened this issue Mar 28, 2019 · 5 comments
Closed

Get-AzStorageAccount does not work for AzureUSGovernment regions #8892

J0R3D1N opened this issue Mar 28, 2019 · 5 comments
Labels

Comments

@J0R3D1N
Copy link

J0R3D1N commented Mar 28, 2019

Description

When using Get-AzStorageAccount, the cmdlet errors due to API versioning mismatches.

Steps to reproduce

Connect-AzAccount -Environment AzureUSGovernment
Get-AzStorageAccount -ResourceGroupName <RGName> -Name <StorageAccountName>

Get-AzStorageAccount : No registered resource provider found for location 'usgovarizona' and API version '2018-11-01'
for type 'storageAccounts'. The supported api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01, 2017-10-01,
2017-06-01, 2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported locations
are 'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, usdodeast, usdodcentral'.
At line:1 char:1
+ Get-AzStorageAccount -ResourceGroupName lab-carbon-rg -Name carbonstg ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzStorageAccount], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand


PS C:\Users> $error[0] | fl * -f


writeErrorStream      : True
PSMessageDetails      :
Exception             : Microsoft.Rest.Azure.CloudException: No registered resource provider found for location
                        'usgovarizona' and API version '2018-11-01' for type 'storageAccounts'. The supported
                        api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01, 2017-10-01, 2017-06-01,
                        2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported
                        locations are 'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, usdodeast, usdodcentral'.
                           at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessag
                        esAsync>d__8.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
                        task)
                           at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsyn
                        c>d__7.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
                        task)
                           at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(ISto
                        rageAccountsOperations operations, String resourceGroupName, String accountName, Nullable`1
                        expand)
                           at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
                           at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
TargetObject          :
CategoryInfo          : CloseError: (:) [Get-AzStorageAccount], CloudException
FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Environment data


Module versions

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.17134.590                                                                           
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.17134.590                                                                          
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 

Debug output

DEBUG: 10:40:33 AM - GetAzureStorageAccountCommand begin processing with ParameterSet 'AccountNameParameterSet'.
DEBUG: 10:40:33 AM - using account id ''...
DEBUG: [Common.Authentication]: Authenticating using Account: '',
environment: 'AzureUSGovernment', tenant: '8a09f2d7-8415-4296-92b2-80bb4666c5fc'
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - AcquireTokenHandlerBase.cs:
=== Token Acquisition started:
 Authority: https://login.microsoftonline.us/8a09f2d7-8415-4296-92b2-80bb4666c5fc/
 Resource: https://management.core.usgovcloudapi.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: null
 Authentication Target: User

DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM:  - TokenCache.cs: Deserialized 4 items to token cache.
DEBUG: [ADAL]: Verbose: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - TokenCache.cs: Looking up cache
for a token...
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - TokenCache.cs: An item
matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - TokenCache.cs:
40.7723900166667 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - TokenCache.cs: A matching item
 (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 88d13074-604c-4f2a-b189-f0517358c52e - AcquireTokenHandlerBase.cs:
=== Token Acquisition finished successfully. An access token was retuned:
 Access Token Hash: fgeaL9sT1LdhARQyEEvcfFo+FbUwZn2wErFM/CjjGpY=
 Expiration Time: 3/28/2019 6:21:20 PM +00:00
 User Hash: dx2axfqrHCHxaIxAnYXErtTQhYS5occqwwHcgHokAxA=

DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - AcquireTokenHandlerBase.cs:
=== Token Acquisition started:
 Authority: https://login.microsoftonline.us/8a09f2d7-8415-4296-92b2-80bb4666c5fc/
 Resource: https://management.core.usgovcloudapi.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: null
 Authentication Target: User

DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM:  - TokenCache.cs: Deserialized 4 items to token cache.
DEBUG: [ADAL]: Verbose: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - TokenCache.cs: Looking up cache
for a token...
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - TokenCache.cs: An item
matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - TokenCache.cs:
40.7723733983333 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - TokenCache.cs: A matching item
 (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 3/28/2019 5:40:33 PM: 73d180dd-eaee-42c5-925e-ce48f74ada3c - AcquireTokenHandlerBase.cs:
=== Token Acquisition finished successfully. An access token was retuned:
 Access Token Hash: fgeaL9sT1LdhARQyEEvcfFo+FbUwZn2wErFM/CjjGpY=
 Expiration Time: 3/28/2019 6:21:20 PM +00:00
 User Hash: dx2axfqrHCHxaIxAnYXErtTQhYS5occqwwHcgHokAxA=

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.usgovcloudapi.net/subscriptions/e2633106-5acc-4749-a89d-82c7f4795801/resourceGroups/lab-carbon-rg/pr
oviders/Microsoft.Storage/storageAccounts/carbonstgacct42?api-version=2018-11-01

Headers:
x-ms-client-request-id        : 7da0e93b-bd63-4668-a4ce-8c7cfc05ed2d
accept-language               : en-US

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : c90978b7-b814-4b36-a1bd-1bf5ecf476ac
x-ms-correlation-request-id   : c90978b7-b814-4b36-a1bd-1bf5ecf476ac
x-ms-routing-request-id       : USGOVARIZONA:20190328T174035Z:c90978b7-b814-4b36-a1bd-1bf5ecf476ac
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Thu, 28 Mar 2019 17:40:34 GMT

Body:
{
  "error": {
    "code": "NoRegisteredProviderFound",
    "message": "No registered resource provider found for location 'usgovarizona' and API version '2018-11-01' for type
 'storageAccounts'. The supported api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01, 2017-10-01, 2017-06-01,
 2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported locations are
'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, usdodeast, usdodcentral'."
  }
}

Get-AzStorageAccount : No registered resource provider found for location 'usgovarizona' and API version '2018-11-01'
for type 'storageAccounts'. The supported api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01, 2017-10-01,
2017-06-01, 2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported locations
are 'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, usdodeast, usdodcentral'.
At line:1 char:1
+ Get-AzStorageAccount -ResourceGroupName lab-carbon-rg -Name carbonstg ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzStorageAccount], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand

DEBUG: AzureQoSEvent: CommandName - Get-AzStorageAccount; IsSuccess - False; Duration - 00:00:00.5547195; Exception -
Microsoft.Rest.Azure.CloudException: No registered resource provider found for location 'usgovarizona' and API version
'2018-11-01' for type 'storageAccounts'. The supported api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01,
2017-10-01, 2017-06-01, 2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported
locations are 'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, usdodeast, usdodcentral'.
   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAccountsOperations
operations, String resourceGroupName, String accountName, Nullable`1 expand)
   at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 10:40:34 AM - GetAzureStorageAccountCommand end processing.
DEBUG: 10:40:34 AM - GetAzureStorageAccountCommand end processing.

Error output



   HistoryId: 121


RequestId      : a4f1e876-d339-4e5e-9b46-dd4ba64bfe10
Message        : No registered resource provider found for location 'usgovarizona' and API version '2018-11-01' for 
                 type 'storageAccounts'. The supported api-versions are '2018-07-01, 2018-03-01-preview, 2018-02-01, 
                 2017-10-01, 2017-06-01, 2016-12-01, 2016-07-01, 2016-05-01, 2016-01-01, 2015-06-15, 
                 2015-05-01-preview'. The supported locations are 'usgoviowa, usgovvirginia, usgovtexas, usgovarizona, 
                 usdodeast, usdodcentral'.
ServerMessage  : NoRegisteredProviderFound: No registered resource provider found for location 'usgovarizona' and API 
                 version '2018-11-01' for type 'storageAccounts'. The supported api-versions are '2018-07-01, 
                 2018-03-01-preview, 2018-02-01, 2017-10-01, 2017-06-01, 2016-12-01, 2016-07-01, 2016-05-01, 
                 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported locations are 'usgoviowa, usgovvirginia, 
                 usgovtexas, usgovarizona, usdodeast, usdodcentral'. 
                 (System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError])
ServerResponse : {BadRequest}
RequestMessage : {GET https://management.usgovcloudapi.net/subscriptions/e2633106-5acc-4749-a89d-82c7f4795801/resourceG
                 roups/lab-carbon-rg/providers/Microsoft.Storage/storageAccounts/carbonstgacct42?api-version=2018-11-01
                 }
InvocationInfo : {Get-AzStorageAccount}
Line           : Get-AzStorageAccount -ResourceGroupName lab-carbon-rg -Name carbonstgacct42
Position       : At line:1 char:1
                 + Get-AzStorageAccount -ResourceGroupName lab-carbon-rg -Name carbonstg ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync
                 >d__8.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7.
                 MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAcc
                 ountsOperations operations, String resourceGroupName, String accountName, Nullable`1 expand)
                    at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 121




@blueww
Copy link
Member

blueww commented Mar 29, 2019

@J0R3D1N
This is caused by AzureUSGovernment regions still Not support API version 2018-11-01.
I have sent mail to SRP team to confirm it.

The api version 2018-11-01 currently is only in the latest Powershell version 1.6.0 (Az.storage 1.1.0), would you please use an early version like Az.Storage 1.0.3, this use api version 2018-07-01.

You can install Az.Storage 1.0.3 by:

  1. Remove the Az.Storage by :
    uninstall-module Az.storage
  2. install Az.Storage 1.0.3 by:
    Install-Module Az.Storage -RequiredVersion 1.0.3 -Repository PSGallery

@J0R3D1N
Copy link
Author

J0R3D1N commented Mar 29, 2019

This work around works. I saw the note to SRP, thanks! Any chance there are other cmdlets affected similarly like Az.Storage where the API version isn't available in specific regions?

@blueww
Copy link
Member

blueww commented Mar 29, 2019

I owns Az.Storage. I don't know if other cmdlets will be affect by that. But the api version 2018-11-01 currently should only be used by Az.Storage module.

@blueww
Copy link
Member

blueww commented Apr 8, 2019

@J0R3D1N

As this issue is on server, and can't fix by Powershell cmdlets side, do you mind we close the issue now, and keep tracking the deployment of 2018-11-01 api version with the mail?

@J0R3D1N
Copy link
Author

J0R3D1N commented Apr 8, 2019

Yes, you can close this and keep me updated in e-mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants