Azure-docs: Cannot bind argument to parameter 'AbsoluteUri' because it is null

Created on 18 May 2018  Â·  26Comments  Â·  Source: MicrosoftDocs/azure-docs

While running the above script i get the following error:
Cannot bind argument to parameter 'AbsoluteUri' because it is null?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-bug triaged unspecifieprod virtual-machines-windowsvc

All 26 comments

@saachinvettiyattil Thanks for the feedback! We are currently investigating and will update you shortly.

What is the output if you run the following:

#Provide the subscription Id of the subscription where snapshot is created
$subscriptionId = "yourSubscriptionId"

#Provide the name of your resource group where snapshot is created
$resourceGroupName ="yourResourceGroupName"

#Provide the snapshot name 
$snapshotName = "yourSnapshotName"

#Provide Shared Access Signature (SAS) expiry duration in seconds e.g. 3600.
#Know more about SAS here: https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1
$sasExpiryDuration = "3600"

#Provide storage account name where you want to copy the snapshot. 
$storageAccountName = "yourstorageaccountName"

#Name of the storage container where the downloaded snapshot will be stored
$storageContainerName = "yourstoragecontainername"

#Provide the key of the storage account where you want to copy snapshot. 
$storageAccountKey = 'yourStorageAccountKey'

#Provide the name of the VHD file to which snapshot will be copied.
$destinationVHDFileName = "yourvhdfilename"


# Set the context to the subscription Id where Snapshot is created
Select-AzureRmSubscription -SubscriptionId $SubscriptionId

#Generate the SAS for the snapshot 
$sas = Grant-AzureRmSnapshotAccess -ResourceGroupName $ResourceGroupName -SnapshotName $SnapshotName  -DurationInSecond $sasExpiryDuration -Access Read 

Then if you run $sas.AccessSAS

After running the script and then the command $sas.AccessSAS I dont get any output.

While running the whole script the error that i get is as follows:

Start-AzureStorageBlobCopy : Cannot bind argument to parameter 'AbsoluteUri' because it is null.
At line:1 char:51

  • ... obcopy=Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestCo ...
  • ~~~~~~

    • CategoryInfo : InvalidData: (:) [Start-AzureStorageBlobCopy], ParameterBindingValidationException

    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.StartAzureStorageBlobCopy

@saachinvettiyattil thanks for confirming that.

@ramkumarkrishnan can you take a look at this?

@saachinvettiyattil if you still have this active, can you take a look at the snapshot in the portal and see if you have a message that looks like: "A SAS URL has been generated for this snapshot for export. You can cancel the export by clicking the button below. This will revoke the SAS URL and may cancel any in-progress transfers if the snapshot is currently being downloaded to another location."

I'm trying to replicate this and I also get nothing from $sas.AccessSAS, but it looks like a SAS URL has been created.

There are a also a couple of casing mis-matches between the variables and when they are used in the script, so I'll try and see if Raman can fix those as well, but I wanted to see if you could tell from the portal if a SAS URL has been created.

Thanks!

@cynthn
Yes i do see a message saying sas url has been generated for this snapshot for export. you can cancel the export by clicking the button below.
It seems like sas url has been generated but some how cannot bind the parameter to absolute uri.

after generating the sas uri through portal and passing the value to the parameter it work fines,
but while generating it through powershell doesnot works.

I will need help to understand what I am supposed to do.

Get Outlook for Androidhttps://aka.ms/ghei36


From: saachinvettiyattil notifications@github.com
Sent: Monday, May 21, 2018 11:05:11 PM
To: MicrosoftDocs/azure-docs
Cc: Ramkumar Krishnan; Mention
Subject: Re: [MicrosoftDocs/azure-docs] Cannot bind argument to parameter 'AbsoluteUri' because it is null (#8837)

@cynthnhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcynthn&data=02%7C01%7Cramkumar.krishnan%40microsoft.com%7C95904a8fcc4d4f032b1408d5bfa9fa80%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636625659126845837&sdata=2kAfe0DdjOGkqz1YZpiSGNq8jrJkrVGtSilpxDNViCE%3D&reserved=0
Yes i do see a message saying sas url has been generated for this snapshot for export. you can cancel the export by clicking the button below.
It seems like sas url has been generated but some how cannot bind the parameter to absolute uri.

after generating the sas uri through portal and passing the value to the parameter it work fines,
but while generating it through powershell doesnot works.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F8837%23issuecomment-390873307&data=02%7C01%7Cramkumar.krishnan%40microsoft.com%7C95904a8fcc4d4f032b1408d5bfa9fa80%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636625659126855845&sdata=GcKk7x1SbBiLnmPQoPaLqi8UCTgY%2FURYGk3jH8dolGo%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOZIV2XETExagrFzfXlhg-gzDWnyrlZ6ks5t06qXgaJpZM4UEiIl&data=02%7C01%7Cramkumar.krishnan%40microsoft.com%7C95904a8fcc4d4f032b1408d5bfa9fa80%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636625659126865853&sdata=Z%2BQ5NNBO2vHzFZFyzsihNIbbkDe16L2Dy0d4Q3gdysc%3D&reserved=0.

@saachinvettiyattil yep, I suspect it is a bug in PowerShell. I'm running 5.0.0 of AzureRM.Storage. I'll sync with the PM today and see what we can find out. Thanks for catching this!

@ramkumarkrishnan I think you accidentally got tagged for this - it should be @ramankumarlive (Raman Kumar from Azure Storage).

@cynthn @ramankumarlive any updates on the issue. has it been resolved.

the same error...

Start-AzureStorageBlobCopy : Cannot bind argument to parameter 'AbsoluteUri' because it is null.

same issue for me

just tried it upon azure automation account
same error - Cannot bind argument to parameter 'AbsoluteUri' because it is null
I have checked in the portal and the sas token is granter
Visual Studio Enterprise – MPN subscription

The Error is because the $sas.AccessSAS get from following cmdlet is null. So it can't be binding to storage cmdlets. (-AbsoluteUri expect a string of URI instead of null value, so it will report error since the input is invalid)

$sas = Grant-AzureRmSnapshotAccess -ResourceGroupName $ResourceGroupName -SnapshotName $SnapshotName  -DurationInSecond $sasExpiryDuration -Access Read 

I see the related cmdlet is last modified by @hyonholee. Would you please help to look?

Because of some reason cant grant access to the managed disk and thats why $sas.AccessSAS URL is null.

i solved it for myself..
just go to managed disk on portal and create SAS URL by clickling "Export"
Copy SAS URL
on Powershell assing this vaule as variable for $sas ($sas=SAS URL)
then it will worked..

Could it be related to powershell session in the browser? Yesterday I had the same issue when using cloud shell but successfully ran the copy using standard shell.

Because of some reason cant grant access to the managed disk and thats why $sas.AccessSAS URL is null.

i solved it for myself..
just go to managed disk on portal and create SAS URL by clickling "Export"
Copy SAS URL
on Powershell assing this vaule as variable for $sas ($sas=SAS URL)
then it will worked..

This is not a fix. This is a work-around.

1:23

Hello. No updates on this issue? It is happening for me as well.

Please fix this bug. It is not possible to work around it without using the Azure Portal UI, which makes it a blocking issue for anyone trying to use this command for automation.

Because of some reason cant grant access to the managed disk and thats why $sas.AccessSAS URL is null.

i solved it for myself..
just go to managed disk on portal and create SAS URL by clickling "Export"
Copy SAS URL
on Powershell assing this vaule as variable for $sas ($sas=SAS URL)
then it will worked..

Did not work for me. It is throwing an authentication error trying to use the URL generated on the Azure Portal.

HTTP Status Code: 403 - HTTP Error Message: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Please update the module to get the latest change using the instructions here: https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-6.9.0#install-the-azure-powershell-module

I had the same issue. Migrating from Azure RM to Az and finally turning on compatability mode worked for me. You can follow this guide to move to Azure Az: https://docs.microsoft.com/en-us/powershell/azure/migrate-from-azurerm-to-az?view=azps-1.1.0

  1. Unintstall all versions of Azure RM
  2. Install Azure Az
  3. Turn on compatability: Enable-AzureRmAlias -Scope CurrentUser
  4. Run above script

@ramankumarlive and @roygara Can someone walk through this scriptto see if it is working now or needs to be updated? Thanks!

assign @roygara

I've gone ahead and tested the script, there were some invalid characters which I've removed and after making those modifications the script worked.

I went ahead and updated the script proper so now the live version reflects these changes as well.

Accordingly, I'm closing this out.

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spottedmahn picture spottedmahn  Â·  3Comments

DeepPuddles picture DeepPuddles  Â·  3Comments

bdcoder2 picture bdcoder2  Â·  3Comments

Ponant picture Ponant  Â·  3Comments

varma31 picture varma31  Â·  3Comments