I have a BlobTrigger azure function on Powershell. I am trying get the blob uri in order to create a managed disk out of this vhd blob with the below scipt:
$diskConfig = New-AzDiskConfig -AccountType $storageType -Location $location -CreateOption Import -StorageAccountId $storageAccountId -SourceUri $sourceVHDURI
New-AzDisk -Disk $diskConfig -ResourceGroupName $resourceGroupName -DiskName $diskName
From the cloud shell, i can get the uri with code below:
$(Get-AzureStorageBlob -Blob myblob -Container 'mycontainer' -Context $StorageContext).ICloudBlob.uri.AbsoluteUri
But with Azure Functions, i cannot. My AF code is below:
# Input bindings are passed in via param block.
param([byte[]] $InputBlob, $TriggerMetadata)
# Write out the blob name and size to the information log.
Write-Host "PowerShell Blob trigger function Processed blob! Uri: $($InputBlob.ICloudBlob.uri.AbsoluteUri)"
$InputBlob.ICloudBlob.uri.AbsoluteUri returns empty. I have checked blob documentation , but couldn't find any solutions.
Do you have any suggestions?
$InputBlobalready contains the data from the blob as a byte array. Are you sure you need the URI?$TriggerMetadata.Urishould give you the URI