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

grant-azurermsnapshotaccess returning null accesssas #5956

Closed
ikiris04 opened this issue Apr 13, 2018 · 30 comments
Closed

grant-azurermsnapshotaccess returning null accesssas #5956

ikiris04 opened this issue Apr 13, 2018 · 30 comments
Assignees
Labels
Compute Service Attention This issue is responsible by Azure service team.

Comments

@ikiris04
Copy link

ikiris04 commented Apr 13, 2018

Description

grant-azurermsnapshotaccess returns an object with accesssas equal to null in azurerm.compute 4.0.0 and up (including 4.6.0). Last version that works correctly is 3.4.1

Debug shows that http response contains accesssas but the cmdlet is not returning it

Script/Steps for Reproduction

#create storage snapshot
$debugpreference = 'Continue'
$returnsas=Grant-AzureRmSnapshotAccess -ResourceGroupName rgimagebuild -SnapshotName rhel7-snapshot -access read -DurationInSecond 7200
#returnsas.accesssas is null

Module Version

PS C:> Get-Module -Name azurerm -ListAvailable

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 5.7.0 AzureRM
Script 5.4.1 AzureRM
Script 5.1.1 AzureRM
Script 4.3.1 AzureRM
Script 4.2.0 AzureRM

PS C:> Get-Module -Name azurerm.compute -ListAvailable

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 4.6.0 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 4.3.2 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 4.1.1 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 4.0.0 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 3.4.1 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 3.3.1 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script 3.2.0 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...

Environment Data

PS C:> $psversiontable

Name Value


PSVersion 5.1.15063.966
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.966
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Debug Output

<!-- Please run the above script with $DebugPreference = "Continue" and paste the resulting debug stream in the below code block -->


PS C:\> $debugpreference = 'Continue'
PS C:\>  Grant-AzureRmSnapshotAccess -ResourceGroupName rgimagebuild -SnapshotName rhel7-euw1-p01us-snapshot -access Rea
d -DurationInSecond 7200
DEBUG: 4:12:04 PM - GrantAzureRmSnapshotAccess begin processing with ParameterSet 'DefaultParameter'.
DEBUG: 4:12:04 PM - using account id '<redacted>'...
DEBUG: [Common.Authentication]: Authenticating using Account: '<redacted>', environment: 'AzureCloud',
tenant: '<redacted>'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - AcquireTokenHandlerBase: === Token Acquisition
started:
 Authority: https://login.microsoftonline.com/<redacted>/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
 Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - TokenCache: 52.6072823133333 minutes left until
token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - TokenCache: A matching item (access token or refresh
 token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: 053739c3-e949-4362-b4e7-46ab4fee5684 - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
 Access Token Hash: 4qQLj12qYWkL3roCjUOvhWcuIELOEotIV1VI9h+dyts=
 Refresh Token Hash: gp7Fs7JL2lxMtWKEUYDgMEn3YYzcsISgOvME4gk55d8=
 Expiration Time: 04/14/2018 00:04:40 +00:00
 User Hash: YajMusBtYseWr2tqUvOEfmgMR3gKk1QaGU42yWuYOBU=

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04:  - TokenCache: Serializing token cache with 2 items.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - AcquireTokenHandlerBase: === Token Acquisition
started:
 Authority: https://login.microsoftonline.com/<redacted>/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
 Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - TokenCache: 52.6054067533333 minutes left until
token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - TokenCache: A matching item (access token or refresh
 token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04: d4a4c3b6-8aac-47eb-b59f-9416ba7f2deb - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
 Access Token Hash: 4qQLj12qYWkL3roCjUOvhWcuIELOEotIV1VI9h+dyts=
 Refresh Token Hash: gp7Fs7JL2lxMtWKEUYDgMEn3YYzcsISgOvME4gk55d8=
 Expiration Time: 04/14/2018 00:04:40 +00:00
 User Hash: YajMusBtYseWr2tqUvOEfmgMR3gKk1QaGU42yWuYOBU=

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:04:  - TokenCache: Serializing token cache with 2 items.
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/<redacted>/resourceGroups/rgimagebuild/providers/M
icrosoft.Compute/snapshots/rhel7-euw1-p01us-snapshot/beginGetAccess?api-version=2018-04-01

Headers:
x-ms-client-request-id        : f62fcc87-28a8-4fcf-8cf1-409eb2d8419d
accept-language               : en-US

Body:
{
  "access": "Read",
  "durationInSeconds": 7200
}

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

Status Code:
Accepted

Headers:
Pragma                        : no-cache
Azure-AsyncOperation          :
https://management.azure.com/subscriptions/<redacted>/providers/Microsoft.Compute/locations/w
esteurope/DiskOperations/4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1?api-version=2018-04-01
x-ms-ratelimit-remaining-resource:
Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;239,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;1194
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : 5749f747-ce36-45de-b2b8-3e734c5abf69_131652735666289094
x-ms-request-id               : 4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1
Cache-Control                 : no-cache
Location                      :
https://management.azure.com/subscriptions/<redacted>/providers/Microsoft.Compute/locations/w
esteurope/DiskOperations/4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1?monitor=true&api-version=2018-04-01
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : f6510914-1c48-4e72-b54b-1ba37b9e1efc
x-ms-routing-request-id       : CANADAEAST:20180413T231206Z:f6510914-1c48-4e72-b54b-1ba37b9e1efc
X-Content-Type-Options        : nosniff
Date                          : Fri, 13 Apr 2018 23:12:05 GMT

Body:


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - AcquireTokenHandlerBase: === Token Acquisition
started:
 Authority: https://login.microsoftonline.com/<redacted>/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
 Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - TokenCache: 52.0744087566667 minutes left until
token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - TokenCache: A matching item (access token or refresh
 token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:36: 4a2641ef-2d79-4086-a532-710aec66f235 - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
 Access Token Hash: 4qQLj12qYWkL3roCjUOvhWcuIELOEotIV1VI9h+dyts=
 Refresh Token Hash: gp7Fs7JL2lxMtWKEUYDgMEn3YYzcsISgOvME4gk55d8=
 Expiration Time: 04/14/2018 00:04:40 +00:00
 User Hash: YajMusBtYseWr2tqUvOEfmgMR3gKk1QaGU42yWuYOBU=

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:36:  - TokenCache: Serializing token cache with 2 items.
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<redacted>/providers/Microsoft.Compute/locations/w
esteurope/DiskOperations/4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1?api-version=2018-04-01

Headers:

Body:


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

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;249987
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : 5749f747-ce36-45de-b2b8-3e734c5abf69_131652735666289094
x-ms-request-id               : fe025dd2-a2a7-4c9d-bea7-35a6698dc0f6
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 14995
x-ms-correlation-request-id   : 0166a2b8-7182-4bfa-a62e-b2e7498237ba
x-ms-routing-request-id       : CANADAEAST:20180413T231236Z:0166a2b8-7182-4bfa-a62e-b2e7498237ba
X-Content-Type-Options        : nosniff
Date                          : Fri, 13 Apr 2018 23:12:35 GMT

Body:
{
  "startTime": "2018-04-13T16:12:06.1866061-07:00",
  "endTime": "2018-04-13T16:12:06.4678771-07:00",
  "status": "Succeeded",
  "properties": {
    "output": {
      "accessSAS":
"https://md-qj031qp44q1c.blob.core.windows.net/bsrskqfxnpd4/abcd?sv=2017-04-17&sr=b&si=28bd26ad-ed18-459c-b7cb-c146a05f
9a49&sig=yJlhVz5r82pxgokgjh%2BUUBN378GPp1T2R8ZN52UxYGE%3D"
    }
  },
  "name": "4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1"
}

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - AcquireTokenHandlerBase: === Token Acquisition
started:
 Authority: https://login.microsoftonline.com/<redacted>/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
 Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - TokenCache: 52.0610018716667 minutes left until
token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - TokenCache: A matching item (access token or refresh
 token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:37: 5377100d-c534-4e7c-af04-7dec791bbbc1 - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
 Access Token Hash: 4qQLj12qYWkL3roCjUOvhWcuIELOEotIV1VI9h+dyts=
 Refresh Token Hash: gp7Fs7JL2lxMtWKEUYDgMEn3YYzcsISgOvME4gk55d8=
 Expiration Time: 04/14/2018 00:04:40 +00:00
 User Hash: YajMusBtYseWr2tqUvOEfmgMR3gKk1QaGU42yWuYOBU=

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 04/13/2018 23:12:37:  - TokenCache: Serializing token cache with 2 items.
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<redacted>/providers/Microsoft.Compute/locations/w
esteurope/DiskOperations/4c3e1afc-c3cd-4f89-9f50-f2d104c3fac1?monitor=true&api-version=2018-04-01

Headers:

Body:


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

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;249986
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : 5749f747-ce36-45de-b2b8-3e734c5abf69_131652735666289094
x-ms-request-id               : b6b61a42-11a2-499a-a12d-8577a182f3c8
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 14994
x-ms-correlation-request-id   : d558f23d-44e7-4574-b006-ea585014989a
x-ms-routing-request-id       : CANADAEAST:20180413T231237Z:d558f23d-44e7-4574-b006-ea585014989a
X-Content-Type-Options        : nosniff
Date                          : Fri, 13 Apr 2018 23:12:36 GMT

Body:
{
  "accessSAS":
"https://md-qj031qp44q1c.blob.core.windows.net/bsrskqfxnpd4/abcd?sv=2017-04-17&sr=b&si=28bd26ad-ed18-459c-b7cb-c146a05f
9a49&sig=yJlhVz5r82pxgokgjh%2BUUBN378GPp1T2R8ZN52UxYGE%3D"
}




DEBUG: AzureQoSEvent: CommandName - Grant-AzureRmSnapshotAccess; IsSuccess - True; Duration - 00:00:33.9046790;
Exception - ;
DEBUG: Finish sending metric.
DEBUG: 4:12:39 PM - GrantAzureRmSnapshotAccess end processing.
DEBUG: 4:12:39 PM - GrantAzureRmSnapshotAccess end processing.
@maddieclayton
Copy link
Contributor

@hyonholee @huangpf Can you take a look at this issue?

@ikiris04
Copy link
Author

ikiris04 commented May 1, 2018

Is there any update?

@liminany
Copy link

liminany commented May 8, 2018

I have same problem,Is there any update?

@maddieclayton
Copy link
Contributor

@hyonholee @huangpf Is there any update on this issue?

@hyonholee
Copy link
Contributor

There is an issue with the Swagger spec and client library. We will fix it soon. Thanks.

@imaculate
Copy link

Similar problem with Grant-AzureRmDiskAccess

@jeanfrancoislarente
Copy link

This just started happening for me. Is there a workaround?

$osSAS = Grant-AzureRmSnapshotAccess -ResourceGroupName $snapshotResourceGroupName -SnapshotName $osSnapshotName -DurationInSecond $sasExpiryDuration -Access Read

I get a null AccessSAS result.

@v-tisheg
Copy link

v-tisheg commented May 14, 2018 via email

@ikiris04
Copy link
Author

You can call az cli from within powershell to get the sas

https://docs.microsoft.com/en-us/cli/azure/snapshot

I tested this but didn’t work thron ugh the whole syntax

@praries880
Copy link
Contributor

@hyonholee Is there a known workaround for the issue?

@jeanfrancoislarente
Copy link

Thanks for the workaround @ikiris04, I (temporarily) changed my script to:

$osSAS=$(az snapshot grant-access -g $snapshotResourceGroupName -n $osSnapshotName --duration-in-seconds $sasExpiryDuration -o tsv)

@pafnow
Copy link

pafnow commented May 31, 2018

Same issue here, any workaround?

@katomel4
Copy link

katomel4 commented Jun 1, 2018

same issue
tried to update to 6.0.1 - no help
https://www.powershellgallery.com/packages/AzureRM/6.0.1

@hyonholee
Copy link
Contributor

We expect the fix would be included in the next Powershell release (6/15). Thanks.

@craiglandis
Copy link
Member

In the meantime a workaround that doesn't require Azure CLI is to set $DebugPreference = 'Continue' before calling Grant-AzureRmSnapshotAccess, redirect the Grant-AzureRmSnapshotAccess output by adding 5>&1 at the end of the line, then parse out the accessSAS value.

$DebugPreference = 'Continue'
$result = Grant-AzureRmSnapshotAccess -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName -Access 'Read' -DurationInSecond 3600 5>&1
$DebugPreference = 'SilentlyContinue'
$sasUri = ((($result | where {$_ -match "accessSAS"})[-1].ToString().Split("`n") | where {$_ -match "accessSAS"}).Split(' ') | where {$_ -match "https"}).Replace('"','')

@Flodu31
Copy link

Flodu31 commented Jun 19, 2018

Hi everyone,
I've the same problem from 20 days now...
The workaround of @craiglandis is working fine, but it's a workaround, thank @craiglandis
Florent

@the-homeless-god
Copy link

the-homeless-god commented Jun 19, 2018

Hi everyone,
I too getting null-object from

Grant-AzureRmDiskAccess `
                    -ResourceGroupName $resourceGroupName `
                    -DiskName $diskName `
                    -DurationInSecond 3600 `
                    -Access Read

But, I've this problem with OS-disks, 'cos DataDisks is easy for get.
What u think about

In the meantime a workaround that doesn't require Azure CLI is to set $DebugPreference = 'Continue' before calling Grant-AzureRmSnapshotAccess, redirect the Grant-AzureRmSnapshotAccess output by adding 5>&1 at the end of the line, then parse out the accessSAS value.

Can it help me?

@dvanderslice
Copy link

Would love if this was fixed we have azure automation runbooks that depend on this working, that just have stopped working altogether because of this.

The above adding the $result does work, thanks for the workaround @craiglandis

@andyjballgit
Copy link

just hit this / eta ?

@ikiris04
Copy link
Author

ikiris04 commented Jul 13, 2018

Have you tried the latest module? I installed on a new laptop last week and didn’t have any problems
I have azurerm.compute 5.1.1 on my machine now and I haven't had any issues..

@medianick
Copy link

Upgrading the AzureRM PowerShell module resolved this issue entirely for me:

PS C:\WINDOWS\system32> Install-Module -Force AzureRM
PS C:\WINDOWS\system32> Get-InstalledModule -Name AzureRM

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
6.5.0      AzureRM                             PSGallery            Azure Resource Manager Module

After this, I was able to use Grant-AzureRmDiskAccess and then the AccessSAS property of its return value (which was no longer empty) as the -AbsoluteUrl value for Start-AzureStorageBlobCopy.

@maddieclayton
Copy link
Contributor

Closing as fixed - if anyone is still hitting this issue in the latest version, please let me know and I will reopen the issue.

@addycluri
Copy link

I updated the AzureRM* modules to the latest and able to access the SAS URL using Grant-AzureRmDiskAccess

PS | C:\WINDOWS\system32 | 09-10-2018 16:33:00 > Get-InstalledModule AzureRm, AzureRm.Compute

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
6.8.1      AzureRM                             PSGallery            Azure Resource Manager Module
5.5.2      AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute
PS | C:\WINDOWS\system32 | 09-10-2018 16:26:40 > $sas = Grant-AzureRmDiskAccess -ResourceGroupName myrg -DiskName mydisk -Access Read -DurationInSecond 100

PS | C:\WINDOWS\system32 | 09-10-2018 16:27:42 > $sas.AccessSAS
https://mystorage.blob.core.windows.net/data/abcd?sv=2017-04-17&sr=b&si=07483bef-f05c-414d-98a2-3ccba29b1e06&sig=xY2f%2BNwOpnxgGMfMyFV0TMwmBMISTvZSyfOL5tEKkpc%3D

Thanks everyone who helped with the interim workaround and the final fix.

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@andsmit9
Copy link

andsmit9 commented Nov 1, 2018

Just got this issue as well.

Versions:

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
5.7.1                AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute service cmdlets for Azure Resource Manager.  Manages virtual machines, hosted services, and related resources in Azure Resource Manager
6.11.0               AzureRM                             PSGallery            Azure Resource Manager Module

Output:

PS C:\OLC> $debugpreference = 'Continue'
PS C:\OLC> Grant-AzureRMSnapshotAccess -ResourceGroupName $targetRGName -SnapshotName $ss.Name -Access 'Read' -DurationInSecond 172800
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/***********/providers/Microsoft.Compute/locations/westeurope/DiskOperations/*********?monitor=true&api-version=2018-04-01

Headers:

Body:



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

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;249991
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : 6af6ecdd-21e4-4ecb-91e8-36eb6aad49ca_131832382693713323
x-ms-request-id               : 02baa0bf-e3fb-4265-a979-6811da68ef57
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-correlation-request-id   : 3c2f02ed-7524-4218-9aec-2360d168135f
x-ms-routing-request-id       : CANADACENTRAL:20181101T125039Z:3c2f02ed-7524-4218-9aec-2360d168135f
X-Content-Type-Options        : nosniff
Date                          : Thu, 01 Nov 2018 12:50:39 GMT

Body:
{
  "accessSAS": "https://***********.windows.net/dqt5twwwbs4c/abcd?sv=2017-04-17&sr=b&si=***********&sig=***********"
}





DEBUG: AzureQoSEvent: CommandName - Grant-AzureRmSnapshotAccess; IsSuccess - True; Duration - 00:00:31.7870990; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 8:50:40 AM - GrantAzureRmSnapshotAccess end processing.
DEBUG: 8:50:40 AM - GrantAzureRmSnapshotAccess end processing.

accessSAS is null.

@andsmit9
Copy link

andsmit9 commented Nov 1, 2018

Had a colleague update to 6.5.0 and try and could access accessSAS value. I rolled my version back to 6.5.0 and still had a null value for accessSAS value. Anyone have any thoughts?

@jeanfrancoislarente
Copy link

jeanfrancoislarente commented Nov 1, 2018

I've been using 6.6 with no issues.
When installing, make sure to use -AllowClobber -Force

---------- -------    ----                                ----------------
Script     6.6.0      azurerm

@addycluri
Copy link

@andsmit9 this might be an issue with multiple modules installed and potentially an older one getting loaded maybe? Hopefully the below link helps

https://github.com/Azure/azure-powershell/wiki/Troubleshooting-Module-Version-Incompatibilities-With-Azure-PowerShell

@andsmit9
Copy link

andsmit9 commented Nov 7, 2018

Thanks for the feedback. I made sure just now to uninstall the AzureRM over and over until there were no modules installed before installing 6.5.0:

PS C:\WINDOWS\system32> Get-InstalledModule AzureRm
PackageManagement\Get-Package : No match was found for the specified search criteria and module names
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.6.5\PSModule.psm1:9125 char:9
+         PackageManagement\Get-Package @PSBoundParameters | Microsoft. ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...lets.GetPackage:GetPackage) [Get-Pac
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage
PS C:\WINDOWS\system32> Install-Module -Force AzureRM -AllowClobber -RequiredVersion 6.5.0
PS C:\WINDOWS\system32> Get-InstalledModule AzureRm

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
6.5.0                AzureRM                             PSGallery            Azure Resource Manager Module

Unfortunately, the result is the same for me: Null value for accessSAS.

Seems to just be my setup but not sure what is causing the conflict. I think we can ignore my issues as no one else seems to have it.

@jeanfrancoislarente
Copy link

@andsmit9 not sure where 6.5 came from, I did mention 6.6 in my post :)
I would try with >= 6.6. I'm not sure why your colleague would have no issues on 6.5. It's possible he has mixed versions (newer)?

Give it a shot with 6.6 or greater, I'm hoping that helps.

@andsmit9
Copy link

andsmit9 commented Nov 8, 2018

Same result on 6.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compute Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests