Azure Breakthroughs: Finding the Azure VM administrator username

Azure Breakthroughs: Finding the Azure VM administrator username

I usually use a range of different usernames to define as the administrator of my Azure Virtual Machines, and I have others that clients shared with me. So, you may be thinking, why are you accessing the Azure VM’s using the administration account and not an AD account? Typically, these are standalone development environments where I need permissions as administrator, so sometimes, this is the quick and easy way. We may argue if this is the best practice or not, but it is without a dought the fastest and easy way.

And today, one of my team members called me asking what was the password of user ABC (not the real username name) to access one of our Azure BizTalk Server Development VM’s because he was trying all possible variants and it was not able to log in. Unfortunately, I don’t remember all the VM administrator usernames I use to create our internal VM, so the first question I asked was not about the password but if he was using the correct username to access the machine. He was not sure about it neither.

So, the main question is: How can you quickly find the Azure VM administrator username of a specific machine?

There maybe be many ways to find this information. I will highlight here two of them that I normally use.

Option 1: Using the Azure Portal

  • Go to Virtual Machines services on your Azure portal.
  • Select the Virtual Machine that you want to find the username.
  • On the Virtual Machine property page, from the option tree, click on the Run command option from the Operations section.
  • On the Run command page, select RunPowerShellScript and them type Get-LocalUser on the PowerShell Script panel and click Run
  • The output will be a list of local user present on the machine mentioning what is the administrator.

Option 2: Using PowerShell

Another easy option is using a simple PowerShell script:

Get-AZVM -Name VM-NAME | Select-Object -ExpandProperty OSProfile

The output of that command will have the Administration username of that VM:

Download

THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download Finding Azure VM Administrator Username from GitHub here:

The post Azure Breakthroughs: Finding the Azure VM administrator username appeared first on SANDRO PEREIRA BIZTALK BLOG.

WCF-SQL Adapter: Connecting to the LOB system has failed. A network-related or instance-specific error occurred while establishing a connection to SQL Server

WCF-SQL Adapter: Connecting to the LOB system has failed. A network-related or instance-specific error occurred while establishing a connection to SQL Server

I been delivering a lot of BizTalk Server Training Courses for Developers and for Administrator in the past years that I normally like to call them “Developing BizTalk Server version Course” or “BizTalk Server Operations, Administration, and Maintenance (OAM) course” – yes I know, I am very creative in terms of names – and one of the good things about using Azure Virtual Machines for that is that we can easily create several developer machines in a short period of time and manage them for not consuming resources. And normally on of the task that is present in both courses is to configure BizTalk Server environment, because I believe that all BizTalk Developers should know the basics of BizTalk Server in terms of installation, configuration and optimizations – tasks that are normally done by BizTalk Administrations – I can go further and say that, in my personal opinion, if you don’t know these basic concepts you are not truly a BizTalk Developer because many things can be done by configurations and not code.

One of these tasks is to install and configure BizTalk Server LOB adapters, in especially SQL Server adapter, since in a Developer standalone machine we will need to have SQL Server, so it is easy to test this LOB Adapter. However, if we create the Azure BizTalk Server 2016 Developer machine, configure BizTalk Server and then install and configure LOB adapters without doing anything more and you try to create a BizTalk Server solution using Visual Studio and generate SQL Server schemas:

  • In the Solution Explorer, right-click your project, click “Add”, and then click “Add Generated Items…”
  • In the “Add Generated Items – <Project Name> dialog box, select “Consume Add Service”, and then click “Add”.
  • Select the sqlBinding and properly configuring the URI

We will get the following error message:

Connecting to the LOB system has failed.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 – The remote computer refused the network connection.).

Connecting to the LOB system has failed: WCF-SQL Adapter

when we try to connect to the SQL Server configured.

Cause

This error may occur for several reasons like BizTalk Server cannot communicate with SQL Server machine because some firewall restrictions or SQL Server does not accept Remote Connections and so on.

However, in our case, we are talking about a standalone BizTalk machine that is trying to access a database in the local SQL Server.

Our problem was that by default what Microsoft could possibly configure wrong in terms of SQL Server protocols on the BizTalk Server developer image on Azure… is actually set up wrongly!

Connecting to the LOB system has failed: SQL Server 2016 Configuration Manager protocols

And as I described in my BizTalk Server Installation and configuration tutorial (see here), one of the important steps is to configure SQL Server Network Protocols, in special ensuring that TCP/IP is enabled and Shared Memory is disabled. You can see how to accomplish this using SQL Server Configuration Manager tool here.

The actual problem that was causing the connecting to fail while trying to connect to the LOB system, in this particular case the SQL Server is because the TCP/IP protocol is disabled.

Solution

To properly configure the protocols for SQL Server, especially the TCP/IP protocol, you should:

  • Press the “Windows key” to switch to Metro UI and type “SQL Server 20016 Configuration Manager” and click on “SQL Server 2016 Configuration Manager” option on Apps menu.
  • In SQL Server Configuration Manager windows, from the left-hand pane expand “SQL Server Network Configuration” option and then click “Protocols for MSSQLSERVER”
  • Verify that both “TCP/IP” and “Named Pipes” are enabled;
  • If not, right-click in the protocol, and then click “Enable”
  • Repeat to enable the other protocol if necessary.
  • Verify that “Shared Memory” is Disable.
  • If not, right-click Shared Memory, and then click “Disable”
  • In the left-hand pane, click “SQL Server Services”, right-click “SQL Server (MSSQLSERVER)”, and then click “Restart”.

Connecting to the LOB system has failed: SQL Server 2016 restart

  • Close SQL Server Configuration Manager.
  • Click “OK” and then “Apply”

After correctly configure the SQL Server protocols, again, especially the TCP/IP, you will be able to successfully connect and generate the SQL Server Schemas that you need for your BizTalk Server Solution.

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira

How to reset the built-in administrator account password from an Azure BizTalk VM.

How to reset the built-in administrator account password from an Azure BizTalk VM.

Are you careless like me who constantly forgets the credentials (not critical)? If so this post about how you can reset the built-in administrator account password on an Azure BizTalk VM will help you not to waste a few hours in vain.

I think that the life of a consultant is difficult regarding system credentials, you have your personal credentials (AD account, company and personal emails, and so on) and for each client, you may also have different credential accounts… If this were not already complicated, each system may have different criteria that require you to have more complicated or simpler passwords. For these cases, the solution is more or less simple, we annoy the sysadmin and ask him to reset our password. However, for our Azure VM that we create in our Azure Subscription for demos or production, well that can be a more complicated scenario and I have tendency to create and delete several BizTalk Server Developer Edition machines, special for POC, Workshops or courses and sometimes (aka all the time) I forgot the built-in administrator password. So, how can we reset the built-in administrator account password from an Azure BizTalk Server VM?

Note: I am referring Azure BizTalk Server VM, mainly because my blog is about Enterprise Integration but this can apply to any type of Azure VM.

Most of the time the answer is very simple:

  • You access the Azure portal (https://portal.azure.com/) and select the Virtual Machine that you want to reset the password
  • Then click Support + Troubleshooting > Reset password. The password reset blade is displayed:

Reset the built-in administrator account password: Azure Portal BizTalk VM

  • You just need to enter the new password, then click Update. And you will see a message on the right upper corner saying the reset password task is processing.

Reset the built-in administrator account password: Azure Portal BizTalk VM task begin

  • The result of the task will be presented in the Notification panel and most of the times you will find a “Successfully reset password” message

Reset the built-in administrator account password: Azure Portal BizTalk VM task complete

But there is always “an exception to the rule”, and that was one of my cases. When I was trying to reset the password through the Azure Portal I was always getting an Unable to reset the password message, don’t know exactly why to be honest. I tried to reset the password by using PowerShell described in the documentation: How to reset the Remote Desktop service or its login password in a Windows VM

Set-AzureRmVMAccessExtension -ResourceGroupName "myResoureGroup" -VMName "myVM" -Name "myVMAccess" -Location WestUS -typeHandlerVersion "2.0" -ForceRerun

But still I was not able to perform this operation and I was getting this annoying error:

…Multiple VMExtensions per handler not supported for OS type ‘Windows’. VMExtension. VMExtension ‘…’ with handler ‘Microsoft.Compute.VMAccessAgent’ already added or specified in input.”

Solution

To solve this problem, I was forced to remove the existing VMExtention by:

  • First by getting the list of extensions on VM to find the name of the existing extension (presented in red on the below picture)
Get-AzureRmVM -ResourceGroupName [RES_GRP_NAME] -VMName [VM_NAME] -Status

Reset the built-in administrator account password: Azure Portal BizTalk VM PowerShell Get-AzureRmVM

  • And then by removing the VMAccess extension from the virtual machine
Remove-AzureRmVMAccessExtension -ResourceGroupName [RES_GRP_NAME] -VMName [VM_NAME] -Name [EXT_NAME]
  • You will get a validation question. “This cmdlet will remove the specified virtual machine extension. Do you want to continue?”, Type “y” and then ENTER to accept and continue.

Reset the built-in administrator account password: Azure Portal BizTalk VM PowerShell Remove-AzureRmVMAccessExtension

After that you can access to the Azure portal (https://portal.azure.com/), select the Virtual Machine that you want to reset the password, click Support + Troubleshooting > Reset password and update the built-in administrator account password without the previous problem.

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira

Windows Azure Automation Error – user_realm_discovery_failed Solved

Windows Azure Automation Error – user_realm_discovery_failed Solved

I was working with Windows Azure Automation using a MSDN account to create a run book that will run nightly to turn off all my running virtual machines. 

This is super easy and you area even provided a sample script that all you need to do is set your Active Directory (AD) User Name and your Subscription Name. 

Once I completed this and created an Automation Asset of Type Credential for my newly created AD User I was all set to go.  The AD User has been added as a co-administrator on the account to allow them access to the virtual machines. 

I set up the account like this:

With this configuration I received the following errors.

6/24/2015 8:27:46 PM, Error: Add-AzureAccount : user_realm_discovery_failed: User realm discovery failed: The remote server returned an error: (500)
Internal Server Error.
At Stop-AllAzureVM:35 char:35
+
    + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount
 
6/24/2015 8:27:47 PM, Error: Select-AzureSubscription : The subscription name Azure Pass doesn’t exist.
Parameter name: name
At Stop-AllAzureVM:39 char:39
+
    + CategoryInfo          : CloseError: (:) [Select-AzureSubscription], ArgumentException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand
 
6/24/2015 8:27:47 PM, Error: Get-AzureVM : No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to
set the default subscription.
At Stop-AllAzureVM:44 char:44
+
    + CategoryInfo          : CloseError: (:) [Get-AzureVM], ApplicationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand

Lets loos closer at the User Name value setup in the Credential:

That’s right is has a space at the end of the name from doing a copy and paste of the user name.

If you run into this error you will want to check your user name setup under both the Asset Type of Credential and your user name entered in your script. 

Once I removed the space everything worked as expected..

Best of luck!