A way to qeury Azure File Storage direct from Automation?

Hello.
I am trying to create a runbook that will query a list of files in Azure File Storage. This works fine from a powershell prompt on an Azure VM, but it appears the same methods in Azure Automation return different objects:
Sample code to just list the files in a given folder:
workflow Get-AzureFileStorageInfo
# Get Azure File Storage Name and Key
$storageName = Get-AutomationVariable -Name 'File Storage Name'
$storageKey = Get-AutomationVariable -Name 'File Storage Key'
# Get subscription and certificate information
$subscriptionName = Get-AutomationVariable -Name "Subscription Name"
$connection = Get-AutomationConnection -Name "Azure Connection"
$certificate = Get-AutomationCertificate -Name $connection.AutomationCertificateName
# Set the current subscription
Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $connection.SubscriptionID -Certificate $certificate
Select-AzureSubscription -Current $subscriptionName
# get azure file storage context and share object
#$ctx = New-AzureStorageContext $StorageName $StorageKey
$s = Get-AzureStorageShare -Name $StorageName
# get list of files from Azure File Storage
Write-Output "Files in the DEMO folder..."
$DemoFiles = Get-AzureStorageFile -Share $s -Path "DEMO"
Write-Output $DemoFiles
I get this error when I run it:
6/02/2015 4:54:34 PM, Error: Get-AzureStorageShare : Cannot bind parameter 'Context'. Cannot convert the 
"Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" value of type 
"Deserialized.Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" to type 
"Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext".
At Get-AzureFileStorageInfo:25 char:25

    + CategoryInfo          : InvalidArgument: (:) [Get-AzureStorageShare], ParameterBindingException
    + FullyQualifiedErrorId : 
CannotConvertArgumentNoMessage,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageShare
I am obviously calling it wrong from Azure Automation. Is there sample code online somewhere that can demo the right way to call it? Thanks!
Matt

Perfect. That worked! Thanks!
For others who might be following this I made the change as shown below:
workflow Get-AzureFileStorageInfo
# Get Azure File Storage Name and Key
$storageName = Get-AutomationVariable -Name 'File Storage Name'
$storageKey = Get-AutomationVariable -Name 'File Storage Key'
# Get subscription and certificate information
$subscriptionName = Get-AutomationVariable -Name "Subscription Name"
$connection = Get-AutomationConnection -Name "Azure Connection"
$certificate = Get-AutomationCertificate -Name $connection.AutomationCertificateName
# Set the current subscription
Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $connection.SubscriptionID -Certificate $certificate
Select-AzureSubscription -Current $subscriptionName
InlineScript {
# get azure file storage context and share object
$ctx = New-AzureStorageContext $Using:StorageName $Using:StorageKey
$s = Get-AzureStorageShare -Context $ctx
# get list of files from Azure
Write-Output "Files in the DEMO folder..."
$DemoFiles = Get-AzureStorageFile -Share $s -Path "DEMO"
Write-Output $DemoFiles

Similar Messages

  • Azure Files Storage not accessible.

    Hi,
    As primary storage mean we are using Azure File storage (smb shares) for our application.
    In the logs we find out that sometimes the shares aren't accessible. Over the last month it happened 9-10 times. In some cases it lasted up to 30 seconds. What can be reason for this? Is it because of preview state?  
    Thanks,
    Kamil

    Hi Kamil,
    It might be due to the Preview Status or due to throttling as well.
    To determine the exact cause, we would require more details which cannot be shared on a public forum.
    Please raise a Technical Case for us to be able to assist you further.
    You could use the following link to raise a technical case:
    http://azure.microsoft.com/en-in/support/options/
    Regards,
    Malar.

  • Azure File Storage - Creating a directory at the root level using REST

    I have a Xamarin / iOS project, and looking to use Azure File Share as a back-end.
    With that in mind, I'm playing around with the REST API and have generally got things working with (a) Blobs and (b) Account-level access to Files.
    Specifically, I can successfully request a list of File Shares, so I have the general call structure worked out.
    However, I'm stumped about the exact incantation necessary to create a new directory at the root level of a share.
    I've tried the following three variants, but all result in Forbidden - Server failed to authenticate the request
    request.Host: myaccount.file.core.windows.net
    request.AbsolutePath: /myshare/subdirname1
    request.Query: ?restype=directory
    string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:07:25 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/subdirname1\nrestype:directory
    request.Host: myaccount.file.core.windows.net
    request.AbsolutePath: /myshare/subdirname1/
    request.Query: ?restype=directory
    string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:07:58 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/subdirname1/\nrestype:directory
    request.Host: myaccount.file.core.windows.net
    request.AbsolutePath: /myshare//subdirname1
    request.Query: ?restype=directory
    string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:06:16 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare//subdirname1\nrestype:directory
    I did note that trying to get the contents of an (empty) root directory doesn't behave quite the way I'd expect
    request.Host: myaccount.file.core.windows.net
    request.AbsolutePath: /myshare/
    request.Query: ?resttype=directory&comp=list
    string to sign: GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:23:17 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/\ncomp:list\nrestype:directory
    Authenticates OK, but generates FAILURE BadRequest - The requested URI does not represent any resource on the server.
    Which is different behaviour from pulling the list of blobs from an empty container (returns 200 with an empty xml list of blobs.
    I've been through the File Service REST API document (dn167006) and found the azurestoragesamples on codeplex, but the former is unclear on working with the root level and the latter is from 2011 and predates File Storage.
    Any insights?

    First, thank you for the quick response and the suggestion about looking at the response content for the string to sign being used. I wasn't aware of that and obviously it's a fantastic resource for figuring this kind of stuff out.
    And what it immediately revealed is it wasn't some subtle oddity in my construction of the STS, it was that I was doing a client.GetAsync(...) and not a client.PutAsync(...). DOH!
    With that sorted, it was trivial to fix.
    In terms of the List Directories and Files, though, there's still a problem.
    FAILURE BadRequest - The requested URI does not represent any resource on the server.
       request.Host: myaccount.file.core.windows.net
       request.AbsolutePath: /myshare
       request.Query: ?resttype=directory&comp=list
       urlQuery: myshare?resttype=directory&comp=list
       string to sign: GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 18:40:04 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare\ncomp:list\nresttype:directory
    The response XML is
    <?xml version="1.0" encoding="utf-8"?>
    <Error>
        <Code>InvalidUri</Code>
        <Message>The requested URI does not represent any resource on the server.\nRequestId:33d61aed-001a-0020-0cbd-51aea8000000\nTime:2014-11-30T18:40:04.9712797Z</Message>
        <UriPath>/myshare</UriPath>
    </Error>
    I originally thought it might be because the share was empty. However, I'm targeting the same share in which I created (apparently successfully) the subdirectory.
    So I'm still confuzzled on that.

  • Move Excel files (400GB) from an external VPS service to Azure file storage

    We are currently using an external VPS service to store 400GB Excel data in multiple files (approx 5000 files stored under 400 directories). Each directory refers to a region and user data within region.
    Would like to copy all files from VPS to Azure storage account.  Any thoughts on the best and most efficient way to accomplish this. 
    Thanks
    Mike 

    Hi Manu
    Thanks.  Once the files are moved to Azure, how do I work on the excel files online? The idea here is to discontinue the third party VPS once all files are moved to Azure successfully. 
    If you read this old thread published in 2010, it looks like excel files cannot be read in Azure unless one uses OpenXML or OpenExcel.  
    https://social.msdn.microsoft.com/Forums/azure/en-US/95127eea-2e76-4d69-8050-65410598860c/reading-excel-file-from-azure-blob-storage-in-worker-role?forum=windowsazuredata
    Thanks
    Mike

  • Can not get exclusive lock on the shared drive of Azure file storage

    One of my application need exclusive access on the data folder where it writes the data.
    I have setup data folder in Z drive which is shared drive of Azure File system.
    The application is not able to get the exclusive access on the data folder and throws IO exception.
    Is that not possible with shared drive of azure file system

    Hi Subodh,
    You could refer the following link for details on how pessimistic concurrency (Exclusive lock) managed in Azure Storage:
    http://azure.microsoft.com/blog/2014/09/08/managing-concurrency-in-microsoft-azure-storage-2/
    Please be advised that an Exclusive lock on an Azure File Share is not possible using REST Protocol and need to be done using the SMB Protocol.
    You could refer the following link for details on how to manage SMB File locking:
    https://msdn.microsoft.com/en-us/library/azure/dn194265.aspx?f=255&MSPPError=-2147217396
    Hope this helps.
    Regards,
    Malar.

  • BPC 7.5 will extract data from flat file or directly from cube

    Hi,
        i have a doubt plz give me a solution.
    1) previously our BPC 7.0 team extracted data from BI 7.0 through flat file, but now they have upgraded to BPC 7.5 i want to know whether BPC 7.5  will extract directly from our BW infocube or not.
    2) please let me know how data extracted from BPC 7.5.
    Thanks and Regards
            Satish

    Hi,
    If your import file has duplicate record in it then the Status of your DM package for import ends with warning, where all the records in your file might have got accepted but only one last data rows amoung the duplicate rows might have got submitted to the system.
    The duplicate records will be rejected and you can see the list of duplicate records as well in the DM package status report.
    Like Nilanjan said you can use Append DM Pacakge to submit all duplicate records aswell into the system. But here the problem is it appends the data in flat file with data available in the system.
    Say you have 100 for account1 in the system and you run Append DM Package having values duplicate values for account1 say 100 and 200. So after the Append Package execution you will have 100100200= 400 for account1.
    So for Append DM package to work in the same way as import, run clear package before executing the Append package.
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Is there a way to delete music files in iTunes from my iPod/iPhone ? Delete option is gone in iOS 7

    Does iOS 7 have a way to delete files in iTunes from my mobile device? And GOD the keyboard is BAD BAD BAD!!!

    Thank you! Before you swiped right to get a delete. Never thought to swipe left :)

  • I had CS6 and now I have installed CC. I cannot open files, place files, etc directly from the File Open... or File Place...   Is there something I'm missing in CC that I don't know about?

    I can open files directly from my Finder window (Mac OS, running latest installment). And I can copy/paste or drag/drop graphics into an open AI file for editing. But I can't use the AI>File>Open... or AI>File>Place... (or any shortcuts). Absolutely nothing happens. It's like I never clicked anything.
    Am I missing something???  I've never had this problem in CS6. Is there something different in CC that I need to add or erase?
    HELP!

    Deornorth wrote:
    I didn't realise that the Camera Raw won't work in 64bit mode. Converting to 32bit enabled the files to be opened.
    Actually, that's wrong. Camera Raw 6.3 WILL run as a 64-bit plug-in when hosted by Photoshop CS5 if CS5 is running as a 64-bit app. It'll run as a 32-bit plug-in when hosted by Bridge or Photoshop CS5 set to run as 32-bit.
    So, there's something else going on here....
    How are you trying to open the raw files? From within Bridge or the Finder? How did you update Camera Raw to version 6.3? From the updater? Is ACR 6.3 in the correct install location? main Library (not the User but root), Application Support/Adobe/Plug-ins/CS5/File Formats/Camera Raw.plugin
    Can you open raw images from within Bridge? Have you tried to view raw files with Bridge before you updated Camera Raw? Have you trashed the cache foe the folder? In Bridge under Tools/Cache/Purge Cache

  • Is there a way to download text files and ebooks from Mac to iPad

    How do I transfer text files and ebooks from my Mac or PC to Ipad

    Read here.
    http://support.apple.com/kb/ht4094
    you can transfer the files to the Apps that support them. pdfs and ebooks can be loaded onto iBooks for instance.
    For regular text files you may need a notes or Text App from the App store.

  • Azure File Storage error The remote name could not be resolved

    I am following http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/ 
    While executing $s = New-AzureStorageShare mysampleshare -Context $ctx  I get error as
    New-AzureStorageShare : The remote name could not be resolved: 'mystorageaccount.file.core.windows.net'
    At line:1 char:6
    + $s = New-AzureStorageShare elasticsearch -Context $ctx
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [New-AzureStorageShare], StorageException
        + FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageShare
    Thanks,
    Subodh

    Azure Files is a Preview feature. Did you request and got access to it at the billing portal's Preview Features (https://account.windowsazure.com/PreviewFeatures)?
    Also, you can now try creating the File share via the Preview Portal (https://portal.azure.com -> your storage account -> "File Shares").

  • Changing the way browser handles txt files to directly download instead of previewing in browser

    When I click on a URL that leads to a txt file, it is being previewed in the browser directly. I would like to change this so that it is downloaded automatically.
    I checked how the application handles "Text Document" objects and it is set to "Save File", however the txt file is still being displayed directly.
    The MIME Type is "text/plain", and seems to match the settings shown in mimetypes.rdf
    What do I do to make it so that txt files are downloaded automatically? Is there some setting similar to pdfjs that is overwriting my own content settings?
    I am using firefox 22

    Right-click the hyperlink and use '''Save Link As...'''.

  • Looking for file storage site from where I could stream my vidos

    Hello guys,
    I have a .mov file from time to time, which I would like to store/post on the internet and send people it's URL so people can click on that link and watch that video.
    I have tried few sites, including mobileMe. They do provide storage for files but the only way people can watch them is that they have to download them first. When I send people link to that file, it does not stream, but it downloads to their computer first. So I am wondering, is there any site where I could store my video files for streaming?
    Thanks for any tips or advise.

    Hi Kirk,
    thanks a lot for your support. This is what I did:
    I have wrote a simple html using Taco. Here is the code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor ="000000">
    <table width="1920" height="720" align="center">
    <tr>
    <td><embed src="BGI.mov" height="720" width="1280" align="middle"></td>
    </tr>
    </table>
    </body>
    </html>
    I have uploaded this html file onto iDisk Public Folder, just beside BGI.mov video file.
    Then I clicked Sharing options. iDisk generated this link:
    files.me.com/iceberger/qwg8qk
    When I copy this link and paste it into my browser window, my browser still downloads this html to my desktop. But when I open it, there is a question mark and no video is playing.
    What I do wrong?
    Thank you so much again for your help and for your patience.

  • Is there any way to move a file or something from one computer to another that will let the new computer backup my iphone over wifi? I don't want to have to sync my phone to the new computer (my sons computer).

    Hi,
    I have my iphone 3GS setup to be able to backup and sync with my computer over wifi. But I want to be able to backup to my sons computer also.
    The things is I don't want to have to sync to his computer first to do this. Is there a file or something I can move from my computer that is setup to his that would let his see my iphone over wifi?

    If you don't have access to the old computer any longer, '''no'''. Unless you were using something like the Google Toolbar & Google Bookmarks or Xmarks, which would have your bookmarks in an online account that you could access. Firefox doesn't include an online storage feature for personal data, yet. That is coming in a future version.
    If you have a friend at your old job maybe they have access to that old PC and they could export your bookmarks to a file and email that file to you.

  • Is there a way of telling if files were transferred from my IPad to s computers?

    II'm wondering if there is anyway I can tell if files have been transferred from my iPad 2 with the latest software to a computer.
    I Have PDFS files in my library that i put on there using iTunes, I know my iPad hasn't been synced with another computer I'm just wondering if i can tell of another reprogram was used to get my files Onto a computer? I only have the iPad and iTunes I don't have the computer that I think was used.

    There are third-party iPad apps such as Simple Transfer (which has a free lite version called Simple Photo & Video Transfer) which can copy photos via your wifi network. The description for Simple Transfer says :
    Simple Transfer is the easiest way of transferring your Photos and Videos to computer and other iOS devices via WiFi. No need for cable, iTunes or extra softwares

  • Since a recent thunderbird upgrade, I can no longer open file attachments directly from my thunderbird email client.

    I can save the file to my computer, then navigate to the file I saved and open it that way. With a very large share drive, though, this takes up a lot of time. I really need to be able to click the file attachment from the thunderbird window and have it open. I'm on a mac running OS X version 10.9.5 and Thunderbird version 31.4.0. Here's a screenshot from my preferences -> attachments. Thanks in advance!

    Your settings show that you want it to ask you every time and not auto open.
    Files can have different extensions: eg: .doc, .csv, .pdf etc
    The extension determines the type of file and different programs are used to open different file types.
    eg: Adobe Reader may be used to open .pdf documents.
    MS Word or OpenOffice.Writer may be used to open .doc documents.
    For Thunderbird to open a document it needs to know what program to use to open that specific type of document.
    In your supplied image it does not specify what program to use with the exception of Content Type: MS PowerPoint Presentation to use program MS PowerPoint.
    All the others state must Always ask.
    Example:
    Content Type: Microsoft Word document
    Action: click on the downward arrow to see a drop down selection.
    If MS Word is in the list select it.
    If you cannot see MS Word in the list, click on 'Use Other'.
    If you can see the program you want to use in the list, select and click on OK.
    If you still cannot see the program, click on 'Browse' button and navigate to the Winword.exe file, select and click on Open.
    when the program has been selected click on OK to save changes to Options.

Maybe you are looking for

  • How can I export artboard color in SVG?

    Hi Expert, My question is if I apply any background color in artboard then I'm not able to convert this in SVG format even If I close and reopen same file then background color makes white. So Is there any way I can convert illustrator file in SVG (

  • Disk problem persists after hard drive replaced

    I've recently inherited a Macbook Pro which proceeded to die almost immediately. It showed all the signs of hard disk failure - erratic crashing, sometimes failing to boot, hanging/going slow. Eventually it completely refused to boot, sometimes showi

  • File to Printer Scenario.

    Hi, I have to make file to Printer scenario. I have closed my previous thread. XI will pick file from File Sender System and put file at File Receiver System. From there file will go to printer. There is one condition: If printer get jammed then from

  • How can I add ?xml-stylesheet to an XML file?

    Hi guys, I have a java code that writes out an XML file. I want to specify the name of a stylesheet in the XML file. How can I do that? This is the source code I have: //---------- Create XML File ------------------ private void createXMLFile(Documen

  • Clarification on different Safari privacy settings

    Recently I was reviewing the different privacy settings in Safari and between web searches and the help file I wasn't able to find the difference between these two settings. Allow from current website only and Allow from websites I visit I tried both