Wojciech X
Wojciech X

Reputation: 375

RabbitMQ/Azure - Connect to RabbitMQ set up on Azure Virtual Machine

I am trying to connect to RabbitMQ on Azure Virtual Machine Server, which I created using Azure Marketplace.

Configuration

1 – I open azure portal -> Market place -> search for RabbitMQ Server -> Create “RabbitMQ Server on Windows Server 2016” -> I leave everything on default (I only change Size to Standard_B2s) -> Click on “Create”

2 – I open my Virtual machine resources on Portal -> Networking -> It looks more or less like this:

Priority Name Port
1010 RabbitMQ80 80
1020 RabbitMQ443 443
1030 RabbitMQ15672 15672
1040 default-allow-rdp 3389
65000 AllowVnetInBound Any
65001 AllowAzureLoadBalancerInBound Any
65500 DenyAllInBound Any

3 – I connect to Virtual Machine using Remote Desktop -> Open Internet Explorer -> Internet options -> Security -> Add localhost to Trusted sites -> Open localhost:15672 –> I see that RabbitMQ is working.

4 – I log into RabbitMQ -> Admin -> I add a new Admin user with password and "Can access virtual hosts" set to “/”.

5 – On my local PC I open browser -> type: {virtual-machine-ip}:15672 -> I see that RabbitMQ is working. -> I tried to log in using new Admin user - it worked.

Question

I am trying to connect to RabbitMQ on Azure Virtual Machine using this code:

var factory = new ConnectionFactory()
{
    HostName = "{vm-ip}",
    UserName = "{new-user}",
    Password = "{new-user-pass}",
    VirtualHost = "/",
    Port = 80
};
using var connection = factory.CreateConnection();
using var channel = connection.CreateModel();

And I am getting this exception:

RabbitMQ.Client.Exceptions.BrokerUnreachableException: „None of the specified endpoints were reachable”

I am sure that I miss some configuration, but I can not find which one. Also, using port 5672 or 15672 does not help. (I added 5672 in Networking rules.)

Upvotes: 0

Views: 846

Answers (0)

Related Questions