Skip to content

Instantly share code, notes, and snippets.

View subhendu-de's full-sized avatar
👓
Coder by Choice

Subhendu De subhendu-de

👓
Coder by Choice
View GitHub Profile
REM login to azure interactively
az login
REM Create the linux azure vm with ubuntu distribution
az vm create \
--resource-group myResourceGroups \
--name ubuntu-vm-lts \
--image UbuntuLTS \
--admin-username azureuser \
--generate-ssh-keys
ssh azureuser@public-ip
REM Use the following command to check the SSH debug trace
ssh -vvv azureuser@public-ip
//Create a CTS to launch a task in charge of renewing the message lock
var brokeredMessageRenewCancellationTokenSource = new CancellationTokenSource();
try {
var brokeredMessage = _client.Receive();
var brokeredMessageRenew = Task.Factory.StartNew(() => {
while (!brokeredMessageRenewCancellationTokenSource.Token.IsCancellationRequested) {
//Based on LockedUntilUtc property to determine if the lock expires soon
if (DateTime.UtcNow > brokeredMessage.LockedUntilUtc.AddSeconds(-10)) {
static void Main(string[] args) {
try {
string sbconnectionString = ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"];
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;
var namespaceManager = NamespaceManager.CreateFromConnectionString(sbconnectionString);
var src_queueName = "source_queue";
var dest_queueName = "destination_queue";
// var dest_queueName = "destination_queue/$deadletterqueue";
QueueClient src_queue = MessagingFactory.CreateFromConnectionString(sbconnectionString).CreateQueueClient(src_queueName, ReceiveMode.ReceiveAndDelete);
QueueClient dest_queue = MessagingFactory.CreateFromConnectionString(sbconnectionString).CreateQueueClient(dest_queueName, ReceiveMode.ReceiveAndDelete);
REM Use az cli version 2.14.0
REM Log in to Azure and authenticate interactively
az login
REM Create the Azure linux vm with default public key id_rsa.pub
REM The resource group myResourceGroups should exists else create it
az vm create ^
--resource-group myResourceGroups ^
--name ubuntu-vm-20102020 ^
--image UbuntuLTS ^
ssh azureuser@public-ip
REM Use the following command to check the SSH debug trace
ssh -vvv azureuser@public-ip
REM Connect to the vm using the ubuntu private key located under .ssh directory
ssh -i .ssh\ubuntu azureuser@public-ip
REM Create a key-pair in .ssh folder with id_rsa and id_rsa.pub names
ssh-keygen
REM Create a key-pair in .ssh folder with ubuntu and ubuntu.pub names
ssh-keygen -f .ssh\ubuntu
REM Log in to Azure and authenticate interactively
az login
REM Create the Azure linux vm with Ubuntu LTS distro
REM The resource group myResourceGroups should exists else create it
az vm create ^
--resource-group myResourceGroups ^
--name ubuntu-vm-21102020 ^
--image UbuntuLTS ^
--admin-username azureuser ^
REM Log in to Azure and authenticate interactively
az login
REM Create the Azure linux vm with Ubuntu LTS distro
REM The resource group myResourceGroups should exists else create it
az vm create ^
--resource-group myResourceGroups ^
--name ubuntu-vm-22102020 ^
--image UbuntuLTS ^
--admin-username azureuser ^
@subhendu-de
subhendu-de / sshd-check.sh
Last active October 23, 2020 05:03
Connect Linux VM using SSH
#!/bin/bash
# Check the status of the SSH daemon service
systemctl status sshd