# Setting Up the Environment and Running the Azure Service Bus Queue Example ## Prerequisites - Azure VM with Windows 10 OS. - Internet connectivity. - Access to Azure Portal to retrieve the Service Bus connection string. --- ## Step 1: Install Visual Studio Code 1. Open a browser on the Azure VM. 2. Download Visual Studio Code from [https://code.visualstudio.com/](https://code.visualstudio.com/). 3. Run the installer and complete the setup. --- ## Step 2: Install .NET Core SDK 1. Go to the [.NET Downloads](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) page. 2. Download the latest version of .NET Core 7.0 SDK for Windows. 3. Run the installer and follow the prompts to complete the installation. 4. Verify the installation by opening a terminal and running: ```bash dotnet --version ``` This should display the installed .NET Core version. --- ## Step 3: Download and Extract the Repository 1. Open a browser on the Azure VM. 2. Navigate to the repository URL: [https://github.com/CodeCraftersGPT/ASBQSender](https://github.com/CodeCraftersGPT/ASBQSender). 3. Click on the **Code** button and select **Download ZIP**. 4. Save the ZIP file to the `C:\` drive. 5. Extract the contents of the ZIP file to `C:\ASBQSender`. --- ## Step 4: Open the Project in Visual Studio Code 1. Launch Visual Studio Code. 2. Open the folder `C:\ASBQSender` in Visual Studio Code. --- ## Step 5: Update the Connection String and Queue Name 1. Create a new Shared Access Signature (SAS) for the Service Bus namespace: - Go to your Azure Portal. - Navigate to the **Service Bus Namespace**. - Under **Shared Access Policies**, create a new policy or use an existing one with **Send** permissions. - Generate a Shared Access Signature and copy the connection string. 2. In Visual Studio Code, open the `Program.cs` file. 3. Replace the placeholder `<YourConnectionStringHere>` in the `connectionString` field with the copied connection string. 4. Update the `queueName` field with the name of your queue (e.g., `orderqueue`). --- ## Step 6: Build and Run the Application 1. Open the terminal in Visual Studio Code (`Ctrl + ~`). 2. Run the following commands to build and run the application: ```bash dotnet build dotnet run ``` 3. You should see output indicating that messages are being sent to the Azure Service Bus Queue. --- ## Step 7: Verify Messages in Service Bus Explorer 1. Open the **Azure Portal**. 2. Navigate to the **Service Bus Namespace** and select the queue you used in the `queueName` field. 3. Use the **Service Bus Explorer** to view the messages in the queue. - Click on **Service Bus Explorer**. - Navigate to the **Queue**. - Select **Peek Messages** or **Receive Messages** to view the messages sent by the application. --- ## Notes - Ensure that your Azure Service Bus namespace and queue are properly configured. - If you encounter any errors, check the terminal output for debugging information. For any issues, refer to the provided `Program.cs` code in this repository for guidance.