Trying to use a SAS on a queue to post a message - Cannot successfully construct client

Using VS 2013, .NET 4.5 target, and WindowsAzureStorageClient from NuGET.
I have a use case where I want an application to post messages to a specific queue, but I don't want to give the storage account keys out (obviously).
So I thought I would create a SharedAccessQueuePolicy, apply it to the queue, and then I can give out the SAS key instead.
To create:
StorageCredentials sc = new StorageCredentials("account",key);
CloudStorageAccount csa = new CloudStorageAccount(sc,false);
CloudQueueClient cqc = new csa.CreateCloudQueueClient();
CloudQueue q = cqc.GetQueueReference("mailbox");
q.Create();
SharedAccessQueuePolicy shAPadd = new SharedAccessQueuePolicy()
Permissions = SharedAccessQueuePermissions.Add,
SharedAccessExpiryTime = new DateTime(2040,12,31,0,0,0)
QueuePermissions qp = new QueuePermissions();
qp.SharedAccessPolicies.Add("addKey", shAPadd);
q.SetPermissions(qp);
To retrieve the key, I use:
//... using an initialised client as above
CloudQueue q = cdc.GetQueueReference("mailbox");
string sastoken = q.GetSharedAccessSignature(new SharedAccessQueuePolicy(), "addKey");
Now, in my client, I retrieve sastoken from the configuration settings, and to add a message, the code I have looks like this:
StorageCredentials sc = new StorageCredentialsSharedAccessSignature(saskey);
CloudQueueClient c = new CloudQueueClient("http://storageaccount.queue.core.windows.net", sc);
CloudQueue q = c.GetQueueReference("mailbox");
CloudQueueMessage m = new CloudQueueMessage("Hello World");
q.AddMessage(m);
However, I always get an exception thrown in the "new CloudQueueClient(....)" line, the additional information for which reads
The supplied credentials '{0'} cannot be used to sign request
That suggests I am obviously doing something wrong, but what is it?
SteveS
Steve Spencer

Hi,
I suggest you read below article, it give us detailed information.
#http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-shared-access-signature-part-2/
I test this on my side, below is my code using SAS in azure queue.
Generate a Shared Access Signature URI for a Queue:
static string GetQuerySasUri(CloudQueue query)
SharedAccessQueuePolicy sasConstraints = new SharedAccessQueuePolicy();
sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddHours(4);
sasConstraints.Permissions = SharedAccessQueuePermissions.Add | SharedAccessQueuePermissions.Read | SharedAccessQueuePermissions.Update;
string sasContainerToken = query.GetSharedAccessSignature(sasConstraints);
return query.Uri + sasContainerToken;
Method to Try Queue Operations Using a Shared Access Signature:
string sas= "https://jamborstorage.queue.core.windows.net/myqueue?sv=2014-02-14&sig=m8fR0Auqo%2FyIDrbPj8BuNbKmeEuD%2Bhw9Yk8HCtEXJeo%3D&se=2014-06-13T11%3A05%3A17Z&sp=rau";
CloudQueue queue = new CloudQueue(new Uri(sas));
queue.CreateIfNotExists();
// Create a message and add it to the queue.
CloudQueueMessage message = new CloudQueueMessage("Hello, World");
queue.AddMessage(message);
Hope this help, if you find this doesn't give you any help, please feel free follow up.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • I updated to ios8 and tried to use Health Application. In Sources I get a message that other applications will show up on the list as they request permission to update your data. How does it happen? No apps are listed on my Sources section

    I updated to ios8 and tried to use Health Application. In Sources I get a message that other applications will show up on the list as they request permission to update your data. How does it happen? No apps are listed on my Sources section

    I have an answer to my question. There is a bug in IOS8 that prevents third party applications to talk to the Health Application. Apple is trying to fix it ASAP

  • I cannot uninstall or install itunes.  error is 'trying to use on a network resource that is unavailable'.  I cannot find a pth to any folders containning installation package itunes.msi.  Unable to download itunes since 2 updates ago and crashed com

    I cannot uninstall or install itunes.  error is 'trying to use on a network resource that is unavailable'.  I cannot find  path to any folders containing installation package itunes.msi.  Unable to download itunes since 2 updates ago and crashed computer.    Windows update as suggested in some posts does not assist either.
    Can anyone assist me?  Thank you so much

    Should the advice above not fix things for you...
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    The further information area has direct links to the current and recent builds in case you have problems downloading, need to revert to an older version or want to try the iTunes for Windows (64-bit - for older video cards) release as a workaround for installation or performance issues, or compatibility with QuickTime or third party software.
    Your library should be unaffected by these steps but there are also links to backup and recovery advice should it be needed.
    tt2

  • Hello. I am having much difficulty using any software drum program. I am trying to use EZ Drummer and the drum programs in Logic, with limited success. I was using them, and they were working, but this is no longer the case. Please help me navigate my way

    Hello.
    I am having much difficulty using any software drum program. I am trying to use EZ Drummer and the drum programs in Logic, with limited success. I was using them, and they were working, but this is no longer the case. Please help me navigate my way through these issues, if possible.
    Thanks.
    Eric

    Aha! I have sorted it.
    For those with similar problems, the solution is this:
    Macintosh HD > Library > Audio > MIDI Drivers
    Then delete DigiDioMidiDriver.plugin

  • I'm trying to use bootcamp assistant and I keep getting an error message saying I need at least 10gb available on my start up disk and I have 27gb available. Any suggestions?

    I'm trying to use bootcamp assistant and I keep getting an error message saying I need at least 10gb available on my start up disk and I have 27gb available. Any suggestions?

    That is not what it says, please post the exact and complete message, take a screenshot.

  • I am trying to use a interactive form and it says "If this message is not eventually replaced by the proper contents of the document, your PDF  viewer may not be able to display this type of document."  This is a IRS form and has worked before.

    I am trying to use a interactive form and it says "see below"  This is a IRS form and has worked before.
    is there a tech support phone number?
    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF
    viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by
    visiting http://www.adobe.com/go/reader_download.
    For more assistance with Adobe Reader visit http://www.adobe.com/go/acrreader.
    Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. Mac is a trademark
    of Apple Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries

    That means you are looking at the form online with a browser that uses its own (incompatible) PDF viewer, not the Adobe Reader plugin.
    Either
    download the form to your local disk and fill it from there
    use a browser that employs the Adobe Reader plugin
    configure your browser to use the Adobe Reader plugin: http://helpx.adobe.com/acrobat/kb/pdf-browser-plugin-configuration.html

  • HT5654 when i attempt to download the 11.1.1 version of itunes i get a prompt stating the feature you are trying to use is on a network resource that is unavailable. i cannot seem to find this path on my system. what do i do?

    How do I install iTunes 11.1.1 when I get a prompt stating " The feature you are trying to use is on a network resource that is unavailable. I have done a search for the .msi file/folder and cannot find it?

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I get an error trying to use Apple Address Book with Word Mail merge - says it cannot open data file?

    I am running MS Word 2011, latest Mac OS, and trying to use the Mail Merge option with the Apple Address Book as the data source.
    However whenever I select the Apple Address Book as the data source, I get the error "Word was unable to open the data source".
    Anybody got any idea why?
    Thanks for your help

    I am guessing you could have solved this little problem already but perhaps someone else may benefit:
    I struggled with the same problem - not being able to use Mac Address Book (i.e. Contacts) with Word 2013 for mac mail-merge (on Mountain Lion and, now, on Mavericks) - with the exact same error message reported by Klausngigtoas above .
    So I read lots of techie stuff on forums which passed a nice few hours but didn't help. Finally, with slumped, defeated expression, I gave up.
    But I just now (such is life) I accidentally stumbled upon the simple solution:
    1. Enter System Preferences and click Security & Privacy.
    2. Select the Privacy tab and then on Contacts on the left hand panel.
    3. In the right hand panel ("Allow the apps below to access your contacts") just tick the Contacts box.
    4. And Voilà! - at least it worked for me - hope it does for you.

  • I am trying to open my apps store but i am getting this message cannot connect to itunes store

    Cannot open apps store i am getting message cannot connect to itune store

    Do you have a good wifi connection?
    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
     Cheers, Tom

  • Trying to use a external hard drive and getting a error message

    My issue is with the Silicon Power H10 1TB Wifi drive. I got everything to link up but my Macbook wants to see it has a remote disc. So when i go to drop a File or movie on it i Get the message i need to Auth the remote Disc click here. When i do the box closes and nothing happens. I am new to IOS programming but I am good with windows.

    Howdy pbfrost,
    You should first check to make sure that your device is compatible with the iPad. See this article -
    If you need help with iPhone, iPad, or iPod touch accessories - Apple Support
    According to the Apple's store requirements for the Seagate Backup, it needs to be used with a computer. See this page -
    Seagate 2TB Backup Plus Slim for Mac Portable Hard Drive - Apple Store (U.S.)
    If you are trying to back up your iPad, you can use either iTunes while connected to a computer, or iCloud. See this article -
    Back up and restore your iPhone, iPad, or iPod touch using iCloud or iTunes - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • I tried to use net banking in my iPad and got a message java not enabled in your browser. What to do?

    JavaScript is already enabled but still getting the error. Please help.

    Java and javascript are not the same thing. It appears you are trying to access your banking using a browser rather than using an app.  Check if your bank has an app.

  • Hi I have an Ipod Touch and I tried to use Imessage and it wouldnt let me send the message

    I have an Ipod Touch and it wont let me send a message in Imessage. And do u have to send it to another Ipod touch or can u send it to a normal phone?

    The Messages app will only send Messages to other Apple iOS devices (iPhone, iPod touch or iPad) that have iOS 5 and have activated the Messages app.
    How to get started with iMessage | How To – CNET
    iOS 5: iMessage not working – how to fix - Apple Toolbox

  • I have a podcast for my running programme on  my new shuffle an access it on 'My Computer' but message on device is 'please use itunes to sync music' . In itunes I message 'cannot be synced because all the podcasts for syncing no longer exist''  Help!!

    Have new nano shuffle for couch to 5K.  Weeks 1 and 2 worked well but week although can be seen downloaded on MY COMPUTER doesn't play and message is 'connect to itunes to sync music'  Tried to sync other podcasts but message is cannot be synced because all the pocastsfor syncing no longer exists.  Any solutions please before I chuck it in the bin. Urrggghhh!

    Well Authorize the Computer...........

  • I have recently unlocked my iPhone 4. I got the comforation saying it was unlocked. For some reason I cannot access my network settings? Any suggestions. I am trying to use the phone on Net 10 network.

    I recently unlocked my iphone 4. I am trying to use it on Net 10's network. However, i cannot access the network settings. I have the Net10 Sim already in it. A few notes listed below of what i have tried:
    1.) I downloaded the iphone configuation utility. But  cannot get the right settings to apply. (so if you have the correct ones i could use those)
    2.) i have watched 1000 youtube videos and been on practically every page online and tried 1000 different versions of APN settings through the configuration
    3.) I do not have another SIM card from another carrier to try.
    Open to suggestions on how i can get the APN settings to change. Not worried about picture messaging or anything, but would like my internet to work. Calls and text work fine.

    i have seen this option..problem being...i dont have access to WIFI i live in the middle of ten buck too! We cant even get internet out here i have to go a friend house to get internet. I was going to try that once i did get to town but was looking for other options here at home frist.

  • HT4847 When trying to use icloud storage message says i need to delete messages. But the indicator says. There is gb's enough! What to do?

    When trying to use icloud storage. On my Imac!
    A message says i need to delete emailmessages. But the indicator says. There is gb's enough! What to do?
    I have tried to delete as much messages from my various email accounts. But still I can't store anything more than is in storage now. (wich is very little KB's)
    My storage account is 25 GB's
    But I can't use it for my Ipad en Iphone?
    Do I have to buy seperate GB in the Icloud foor my 3 devices?
    please help
    Marc Pleijsier
    Holland

    Click here.
    (73432)

Maybe you are looking for

  • Carrier Type In DMS for content server

    Dear All, Can anyone help me in telling which carrier type i have to define in dc20 for Content server, if any required. i have configured content server in Oac0,oact, csadmin, but while saving file on server (check in) it is giving me this error Err

  • MessageConsumer receives no messages

    Hi, i successfully establish a connection to a remote SonicMQ message broker (from one of our custumers) and then call receive to ask the consumer for any messages in the queue, but i always get a NULL return result, indicating that the "MessageConsu

  • IWeb 08:  Blog page and Archive

    I set up a new Blog. The first COMMENT (entered on the Comment page) shows on the Blog page. (it I had set it to show 4 comments) All other comments are on Comment page, but do not show on Blog page. Also, I do not understand how to get any of the Co

  • Typeface on webpages is not as sharp as it was with Internet Explorer.

    I'm using Windows XP. I recently switched my browser to Firefox (LOVED the easy download and simple homepage format and the clear Getting Started instructions!). However, I notice that the typeface or print of text is not as sharp in Firefox as it is

  • I have doubt regading...response.sendRedtrect,

    Hi, I have doubt regading...response.sendRedtrect, That is, it possible to send Session object, one server to another server..using response.sendRedirect. i would very thankful to give this answer, Thank you Ramesh