MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.47k forks source link

Azurite in Visual Studio 2022 Official Version #83901

Closed bobhuang1 closed 2 years ago

bobhuang1 commented 2 years ago

"Azurite is automatically available with Visual Studio 2022 preview, so if you install the preview, you won't have to manually install Azurite." Now that the official Visual Studio 2022 is here, after installing, where can I find it? The command "azurite" shows it does not exist. Thanks!


Document Details

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

SumanthMarigowda commented 2 years ago

@bobhuang1 Thanks for the question! We are investigating and will update you shortly.

SumanthMarigowda commented 2 years ago

@bobhuang1 Firstly apologies for delay in responding here! If you’re using an Azure project such as a project for Azure Functions, Azurite is automatically installed and then it is started. You can see this happening in the output window after creating the project.

When the developer wants to run the project, they just set their configuration to “Release” instead of “Debug”. Then, they can run the project. There is no “Azurite” feature to start. It’s all handled automatically. Prior to Visual Studio 2022, you had to manually install Azurite, and then start Azurite. You performed those tasks at the command line. Those tasks are no longer required on the part of the developer.

We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

idg10 commented 2 years ago

There is no “Azurite” feature to start. It’s all handled automatically

This is unhelpful. What if I want to run a Test Project that exercises code that uses Azure Storage? Visual Studio fails to recognize this as "an Azure project" so it does not automatically start Azurite.

There doesn't appear to be any documented way either to tell VS that my project needs Azure Storage emulation to be available, nor to start the emulator manually.

It's not true to say There is no "Azurite" feature to start. From Process Explorer I can see that VS runs this command line:

"c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\Azure Storage Emulator\azurite.exe" --location "C:\Users\ian\AppData\Local\Temp\Azurite" --debug "C:\Users\ian\AppData\Local\Temp\Azurite\debug.log"

So that's a copy of Azurite buried deep inside some VS folder, not available on the path. There are at least two scenarios in which we need to get VS to run this for us:

  1. before starting test projects that require the emulator to be running
  2. when we want to poke around inside the Azure storage emulator with the Azure Storage Explorer (or a similar tool) prior to running our apps for manual testing purposes
bobhuang1 commented 2 years ago

I totally agree with @idg10 above! What @SumanthMarigowda described could only happen in an ideal world. In the real world, things are much complicated!

With Ian's info, I finally found azurite.exe on my community version of VS2022 and I can start it manually via command line:

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator

I am facing a situation where I need the emulator running for Azure Storage Explorer and pre-load some Blob data into the emulator before my VS project starts debugging. In the old Azure Storage Emulator, I could backup/restore data into a database in MS SQL (where the emulator stores its data), which is VERY convenient when I screw things up during debugging. How can I do that with Azurite? I have to say for most programmers such detailed low-level control is absolutely needed for real work.

Also does Azurite support Tags (for Azure Index Search) and MetaData like real Azure Blob Storage?

Thanks!

bobhuang1 commented 2 years ago

For those who are in the same boat as I am - need to pre-load data and run Azurite BEFORE debugging in VS starts:

  1. Download and install Azure Storage Explorer if you don't already have it: https://azure.microsoft.com/en-us/features/storage-explorer/#features
  2. Make a directory C:\Azurite to store data for Azurite
  3. Make a batch file to start Azurite, I am using community version for pro version Azurite's path see Ian's post above:
    cd C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator
    azurite --silent --location c:\azurite --debug c:\azurite\debug.log
  4. Start by running the above batch file, now Azurite is running with defaults, which is enough for me, I am using the default account (just like the old Storage Emulator):
    Account name: devstoreaccount1
    Account key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
    Connection string: AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;
  5. Start Azure Storage Explorer, it uses defaults to connect to Azurite and you can create containers and upload test data.

The only downside of this is that I can no longer fix screwed-up data quickly by a database restore like in the old Storage Emulator.

More info: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio

flatproject commented 2 years ago

@SumanthMarigowda so I cannot use basically storage emulator for my MVC project unless I go through the hassle that @bobhuang1 describes.... Excellent

normesta commented 2 years ago

Hi all - we've updated the article to make clear the various options for starting Azurite. There are two VS project templates that automatically start Azurite. For other VS projects, you can start Azurite from the command line. Thank you for your patience!

widget31too commented 2 years ago

Is there any way to update a project imported from VS2019 -> VS2022 to launch Azurite? I've got an Azure Functions project that used to run OK, and now I have to run Azurite before launching? Sounds like a step backwards to me...

FinneVirta commented 2 years ago

@SumanthMarigowda I'm having an issue with Azurite not starting automatically in VS 2022 when selecting multiple startup projects. If I select the my Functions project as the single startup project the output for "Service dependencies" shows that Azurite starts up, but when I select multiple nothing is started.

longtimedeveloper commented 2 years ago

@bobhuang1 @SumanthMarigowda @normesta I'm using Microsoft Visual Studio Community 2022 (64-bit) Version 17.0.5 which installs azurite 3.14.1.

UPDATE: To install Azurite 3.15.0, use npm i -g azurite https://www.npmjs.com/package/azurite No need to download and build yourself.

I was unable to get ANY queries to work locally. Spent hours debugging my code then I came across this post. To be clear, any query that only passed the PartitionKey worked. But queries that passed the PartitionKey and RowKey failed. I tried both the LINQ syntax and the filter syntax, both failed.

To get my local Azure Table queries working I had to do this:

  1. Downloaded Azurite v3.15.0 from here https://github.com/Azure/Azurite/releases

  2. Followed the instructions in the readme to build it and install it.

  3. BEFORE I can open an Azure Functions project in VS 2022, I have to run this from the command line: azurite -s -l c:\azurite -d c:\azurite\debug.log to ensure 3.15.0 is running. Now all my queries work.

Please get the Visual Studio Team to include 3.15.0 in their new update.

I could not find a way to build or download Azurite 3.15.0 so I had to do the npm dance and the extra step of pre-starting Azurite.

Can you please let other customers know about this problem and the workaround until this can be corrected?

Maybe this doc can also provide a notice to developers https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio.

The VS 2022 installed version of Azurite. image

macux commented 2 years ago

Hitting a similar issue to @longtimedeveloper, I am hitting this issue which has been fixed since last year but my version of Azurite with VS 2022 is 3.14.1 as above and I need at least 3.14.3.

There doesn't appear to be any docs about how you can ask VS to upgrade Azurite, stuff magically working in the background is great until it doesn't work! This is extra frustrating because I started having issues on this project between the old storage emulator and Azurite at least a year ago (probably two) due to the old being retired before Azurite was ready.

I will probably first try updating my Azure DevOps pipeline to use a specific version of Azurite and allow my local tests to fail that I know have this issue. If it is possible to ask VS to upgrade Azurite it would be good to know how and/or can we just upgrade it and replace the exe that VS uses?

Thanks

longtimedeveloper commented 2 years ago

@macux I strongly agree. Developers need to be able to update Azurite between VS 2022 releases.

ivanzotov1975 commented 2 years ago

What was reason to stop supporting of Cloud Explorer in Visual Studio 2022. It's good tool and i'm still using VS 2019 instead of 2022 only because of this.

longtimedeveloper commented 2 years ago

@ivanzotov1975 I've migrated to VS 2022 so I can use .NET 6 and the newer APIs. I'm using Azure Storage Explorer and it works fantastic. Install from https://docs.microsoft.com/en-us/azure/vs-azure-tools-storage-manage-with-storage-explorer?tabs=windows

If you do go with VS 2022, be sure you install Azurite 3.15.0 (until VS 2022 starts shipping the correct version of Azurite.) Then before you open an Azure project in VS 2022, open and command prompt where you installed Azurite, and run start_azurite.bat Then everything will work super.

Install Azurite 3.15.0, use npm i -g azurite https://www.npmjs.com/package/azurite

Recap

  1. Start Azurite
  2. Start Azure Storage Explorer
  3. Open Azure project in VS 2022

The local development of Azure functions and Azure Data Tables is flawless.

Hope this helps, Karl

naavis commented 2 years ago

@SumanthMarigowda I know this issue was already closed, but it would still be great to have some possibility of updating the Azurite version that comes with Visual Studio 2022. I'm now hitting a wall where the Azure.Storage.Blobs package does not work with the Azurite version that ships with VS2022 because the API has apparently changed, and I have no other option than to install Azurite externally.

longtimedeveloper commented 2 years ago

@naavis @SumanthMarigowda if you use the NPM package I've shown above, the start it before opening up VS 2022, everything works perfectly. I totally agree Microsoft needs a better out-of-the-box experience for Azurite. I had zero issues following my above workflow. Blessings, Karl

mwwhited commented 2 years ago

I'm gonna risk blue badges threating to ban be again and point out how stupid of a problem this is. Microsoft... get back to being a great tool company. Us having to hack around your crap is a silly waste of time.

jackpoz commented 2 years ago

I reported this issue about outdated Azurite included in VS 2022 at https://developercommunity.visualstudio.com/t/VS-2022-ships-outdated-Azurite-version/10026492 . I would suggest adding a comment there and voting as that's the only way to give visibility to this issue.

bang75 commented 2 years ago

Also having problem with not updated Azurite in VS2022. Please fix!

mwwhited commented 2 years ago

Hopefully they don't just push an update that patches the next version but they actually fix VS to use the npm version if that is what they want us to use.

TimDaborn commented 2 years ago

So, while I like the convenience of Visual Studio installing Azurite, this issue where version of Azurite in Visual studio is not being updated when a new version is released, caused me pain. See https://github.com/Azure/Azurite/issues/1476

In addition, having no control over the start command is not helpful either.

jackpoz commented 2 years ago

https://developercommunity.visualstudio.com/t/VS-2022-ships-outdated-Azurite-version/10026492 has been closed with VS 17.2.3 https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes#17.2.3 .

Azurite 3.17.1 is the new shipped version, which is the latest according to https://github.com/Azure/Azurite/releases : image

It's not clear to me if new versions will be included automatically in the future or if someone will have to open a ticket, we will see.

mwwhited commented 2 years ago

It's not clear to me if new versions will be included automatically in the future or if someone will have to open a ticket, we will see.

Based on past experience in other areas we will have to spend months harassing the dev team for them to even realize azurite was upgraded again.

mwwhited commented 2 years ago

Hi all - we've updated the article to make clear the various options for starting Azurite. There are two VS project templates that automatically start Azurite. For other VS projects, you can start Azurite from the command line. Thank you for your patience!

We get that... but it too complex for junior devs and it's a stupid problem that only exists because of how the integration was implemented.

naavis commented 2 years ago

Quoting from the Developer Community page:

We are trying to include the newest supported package as soon as it is available. However, you are always welcome to send your feedback/inquiries through this channel.

John-Bosch commented 2 years ago

I add my voice to those calling for the ability to control the start up of Azurite within Visual Studio. It's stupid that my VS Code and Visual Studio installs use different versions of Azurite and that I have to be careful which starts first!

drdamour commented 1 year ago

well sure sucks that 3.17 that shipped with vs has all types of bugs like not being able to page through a storage table. and the old npm install hack was broken with that 17.2.3 as VS is apparently executing that specific exe and not just calling azurite anymore (which i could override with my nvm).

this is so ridiculous...

mwwhited commented 1 year ago

They broke it again :/ ... it would be so nice if the node install and the vs install were the same thing. Or if we at least had a way to call the node instant automatically on starting the debugger.

drdamour commented 1 year ago

They broke it again :/ ... it would be so nice if the node install and the vs install were the same thing. Or if we at least had a way to call the node instant automatically on starting the debugger.

it used to work that way they just relied on path i think, but now i had to (i use nvm)

npm install -g azurite
npm install -g pkg
pkg -t win-x64 "$env:NVM_SYMLINK\node_modules/azurite/dist/src/azurite.js

and replace the exe in vs dir

mwwhited commented 1 year ago

I'll have to try this... if it works that should be a script that runs as part of the azurite install or is at least included and noted in the docs.

FFranz93 commented 1 year ago

This is still broken. The current version of VS (17.5.1, which I just updated yesterday) comes with Azurite version 3.20.1, while the latest npm version is 3.22.0.

@SumanthMarigowda after so many people reported about this issue, why is there no response from you or any other contributor? The only thing you had to say was that "Azurite does not need to be run manually anymore, it automatically comes with VS". But there is a bunch of people that still has to run Azurite manually, because the version that comes with VS seems to break every other update.

Even the issue posted in the VS Developer Community by @jackpoz was only a temporary fix.

I'm pretty disappointed about that, an can only agree with @mwwhited .

jk-85 commented 1 year ago

Maybe I have a similar problem and I couldn't figure out elsewhere how to fix it when using the integrated VS2022 17.6.5 Azurite. I already updated VS2022 to the latest stable version. Out of a sudden, I don't know why, I didn't update VS2022 and it worked before, ran never into this issue. So some weeks later I get this error when trying to access azurite.

[2023-08-02T16:21:22.051Z] Executed 'Command' (Failed, Id=d4c4e75b-21ca-4be7-a1ac-95af9c519a6b, Duration=170ms) [2023-08-02T16:21:22.055Z] System.Private.CoreLib: Exception while executing function: Command. Azure.Data.Tables: Service request failed. [2023-08-02T16:21:22.059Z] Status: 400 (The REST version of this request is not supported by this release of the Storage Emulator. Please upgrade the storage emulator to the latest version. Refer to the following URL for more information: http://go.microsoft.com/fwlink/?LinkId=392237) [2023-08-02T16:21:22.063Z] [2023-08-02T16:21:22.065Z] Content: [2023-08-02T16:21:22.069Z] <?xml version="1.0" encoding="utf-8" standalone="yes"?> [2023-08-02T16:21:22.072Z] <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> [2023-08-02T16:21:22.077Z] <code>VersionNotSupportedByEmulator</code> [2023-08-02T16:21:22.081Z] <message xml:lang="en-US">The REST version of this request is not supported by this release of the Storage Emulator. Please upgrade the storage emulator to the latest version. Refer to the following URL for more information: http://go.microsoft.com/fwlink/?LinkId=392237 RequestId:4c9c8cab-ca0c-49ec-81ea-5539f5ca35c4 Time:2023-08-02T16:21:21.8990282Z</message> [2023-08-02T16:21:22.085Z] </error> [2023-08-02T16:21:22.091Z] [2023-08-02T16:21:22.093Z] Headers: [2023-08-02T16:21:22.096Z] Server: Microsoft-HTTPAPI/2.0 [2023-08-02T16:21:22.099Z] x-ms-request-id: 4c9c8cab-ca0c-49ec-81ea-5539f5ca35c4 [2023-08-02T16:21:22.105Z] Date: Wed, 02 Aug 2023 16:21:21 GMT [2023-08-02T16:21:22.109Z] Content-Length: 559 [2023-08-02T16:21:22.112Z] Content-Type: application/xml [2023-08-02T16:21:22.115Z] .

longtimedeveloper commented 1 year ago

@SumanthMarigowda why can't this bug be fixed? This has gone on for years. Such a great product smeared and toss in the mud by this setup bug. Please fix this.

jk-85 commented 1 year ago

I fixed it now. I updated azurite.exe this way: Just installed the VS2022 preview, copied the new azurite from

"C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator" to my normal VS2022 17.6.5: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator" and deleted all the other stuff that was lying there before copying.