Created
September 12, 2019 08:51
-
-
Save asabla/7d02aa30de2ee2923549f616c9480513 to your computer and use it in GitHub Desktop.
Small Powershell script to create a local instance of Microsoft ServiceBus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://docs.microsoft.com/en-us/previous-versions/azure/jj193022(v=azure.10)?redirectedfrom=MSDN | |
# Before you can get started, you'll have to install the service it self with Web Platform installer. | |
# A direct link to binary it self can be found on the page from reference link. | |
# Prerequisites | |
# 1. Make sure you have SQL Express installed (at least 2012) | |
# 2. Make sure you have installed the service it self (it won't start until configured) | |
# You can verify this by looking for 'Windows Fabric Host Service' amongst windows services. | |
# Creates a securestring object, which will be used to create a local farm | |
$mycert = ConvertTo-SecureString -string "CoolCertKey1" -Force -AsPlainText | |
# Creates a new local ServiceBus farm | |
New-SBFarm -SBFarmDBConnectionString 'Data Source=localhost\sqlexpress;Integrated Security=True' -CertificateAutoGenerationKey $mycert | |
# It's highly recommended to run this 'Windows Fabric Host Service' as your current user, and thus using password for your | |
# current is required for registering a new ServiceBusHost | |
$pass = ConvertTo-SecureString '<your-local-user-password>' -Force -AsPlainText | |
# Adds your local machine as a new host into earler created farm, this relies both your password and | |
# earlier created certificate | |
Add-SBHost -SBFarmDBConnectionString 'Data Source=localhost\sqlexpress;Initial Catalog=SbManagementDB;Integrated Security=True' -RunAsPassword $pass -CertificateAutoGenerationKey $mycert | |
# Creates a new ServiceBus Namespace | |
# Which account account name you're suppose to use, can be found by running: Get-SBFarm | |
# and it should be listed under 'RunAsAccount', mine for an example is 'emil-b3' | |
New-SBNamespace -Name 'ServiceBusDefaultNamespace' -AddressingScheme 'Path' -ManageUsers '<local account which you login with>'; | |
# If you want to list namespaces (all available) again, you can do so by running this command | |
Get-SBNamespace | |
# Get ServiceBus Client configuration by calling this command | |
# Example from earlier commands would be: Get-SBClientConfiguration -Namespaces 'ServiceBusDefaultNamespace'; | |
Get-SBClientConfiguration -Namespaces '<ServiceBusNameSpace>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment