Based on your comment above, it seems the machines or on different virtual networks, which will prevent them from communicating.
To answer your question in that comment, a resource group is just a container that allows you to group resources for a specific purpose together. It does not grant any communication between the resources, it is just a container. Resource groups have the benefit that you can see what resources you have in that group, and you can easily delete the group, which deletes all resources in it.
A virtual network will sit inside a resource group, and it's this that will join your Virtual Machines and allow them to communicate with each other. You will need to make sure that your VM's are on the same Virtual network.
Azure will also likely have created a network security group for each virtual machine. This is effectively a firewall, and can be configured either at machine level or subnet level. By default they get created at machine level, but have a set of default rules that allow communication between machines on the same Virtual Network, so it should just work in your case (once the machines are on the same network). However if you want to allow outside access to either machine you will need to amend these.