Azure, Azure Integration Services

MalformedToken: Invalid authorization header: The request is missing WRAP authorization credentials.

I was stuck error “MalformedToken: Invalid authorization header: The request is missing WRAP authorization credentials.” while configuring WCF relay in the API management application and BizTalk.

Flow is APIM -> Azure Relay -> BizTalk receive location.

Issue was coming when the APIM was trying to communicate to Azure Relay. I wasn’t sure what was the problem initially but some thing was wrong with Authorization header.

Later on i realized, by reading many msdn articles on how SAS token works. SAS Token is not SAS authorization key we see in Azure portal. SAS token needs to be generated via code as in the article https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token. I picked up PowerShell do it.

Also when i started using this, realized this SAS token generated is valid only for 300 secs. If you want to generate SAS token for infinite then could use 500 years as expiry time.

[Reflection.Assembly]::LoadWithPartialName(“System.Web”)| out-null
$URI=”<relay name>.servicebus.windows.net”
$Access_Policy_Name=”RootManageSharedAccessKey”
$Access_Policy_Key=”<shared access key>”
#Token expires now+300
$Expires=([DateTimeOffset]::Now.AddYears(500).ToUnixTimeSeconds())+300
$SignatureString=[System.Web.HttpUtility]::UrlEncode($URI)+ “`n” + [string]$Expires
$HMAC = New-Object System.Security.Cryptography.HMACSHA256
$HMAC.key = [Text.Encoding]::ASCII.GetBytes($Access_Policy_Key)
$Signature = $HMAC.ComputeHash([Text.Encoding]::ASCII.GetBytes($SignatureString))
$Signature = [Convert]::ToBase64String($Signature)
$SASToken = “SharedAccessSignature sr=” + [System.Web.HttpUtility]::UrlEncode($URI) + “&sig=” + [System.Web.HttpUtility]::UrlEncode($Signature) + “&se=” + $Expires + “&skn=” + $Access_Policy_Name
$SASToken

This article is valid for service bus queue, tables, storage and many azure resources using SAS token based authorization.

Azure

Azure PowerShell Cheat Sheet

# Enable access from Remote
Set-ExecutionPolicy RemoteSigned

# Installs latest modules side by side
Install-Module -Name AzureRM -AllowClobber -Force

# Import the module into the PowerShell session
Import-Module AzureRM
# Connect to Azure with an interactive dialog for sign-in
Connect-AzureRmAccount

# Get all version of the modules installed
Get-Module -Name AzureRM -List | select Name,Version

# To make sure the Azure PowerShell module is available after you install
Get-Module -ListAvailable Azure*

Note: This CheatSheet will undergo updates.





Azure

Visual Studio 2017 does not Show Azure-subscription

Issue:

Visual Studio 2017 does not Show up Azure-subscription whereas in PowerShell console its works.

2018-10-15_20-56-33

Solution option 1:

  1. Close all visual studio instances
  2. Delete %LOCALAPPDATA%.IdentityService file
  3. Restart Visual Studio and log in to server explorer and it might resolve the issue.

Solution option 2:

In Visual Studio 2017, first you need to install Cloud Explorer for Visual Studio 2017 (Tools –> Extensions and Updates). To complete this install, you are going to have to close your project and exit Visual Studio and then it will install.
After you re-open Visual Studio, double check to make sure you installed the Cloud Explorer.

Now open the Cloud Explorer (View –> Cloud Explorer)
You should see a listing item that says “Azure” with your login identifier but it may say
Right click on the item that says Azure and then select “Connect to Microsoft Azure Subscription”
You will need to sign in once again to your Microsoft Account even though you are already signed into Visual Studio 2017
Then it says “One or More Services are not supported by Server Explorer, open in Cloud Explorer”.

2018-10-15_21-42-16

Oyla! it worked.

2018-10-15_22-13-04

.Net, C#, Technology and tricks

System.Runtime.InteropServices.COMException – Task scheduler – Console application

Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
Stack:
at Microsoft.Office.Interop.Excel.Workbooks.Open(System.String, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)
at NotificationReportGenerator.ExcelFactory.ReadExcel(System.String)
at NotificationReportGenerator.Program.Main(System.String[])

The solution for this appalling BUG in Microsoft IIS & Excel is terrific:

  1. Create directory “C:\Windows\SysWOW64\config\systemprofile\Desktop ” (for 64 bit Windows) or “C:\Windows\System32\config\systemprofile\Desktop ” (for 32 bit Windows)
  2. Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
    “IIS AppPool\DefaultAppPool”)
.Net, C#, Visual Studio

Issue with Visual Studio sign using Azure account

If you are ending with errors while logging in to Visual Studio (2015 or 2017) with your Microsoft subscription account with error message “Cookies are blocked, cannot login”. Then below is setting change you need to do in “Internet Options” to resolve it.

Visual studio always used internet engine for internet connectivity and I didn’t find any way to change it to use to Mozilla or any other internet engine.

Below  change in “Internet Options” setting prompts to accept cookies and this resolved the issue.

Untitled.png

After changing, try to login, you we will prompted to accept cookie couple of times. This will resolve the issue

 

Azure

Tips on Becoming MCSA – Cloud Platform

This is my first blog on Azure. I would like to share my experience on the Microsoft exam azure. Before starting will would give background of my achievement. “I’ve cleared 70-532 and 70-534 in single day”. Yes, you heard it right! Trust me this isn’t that difficult

Exam Pattern in Pearson (In general):

There will two parts to exam
1) Survey section :

I felt this survey is not important. This will contain set of survey questions about your proficiency level in each section of that particular exam.

Initially, I felt it some junk thing and marked my self as proficient (highest second) in survey for 70-532 exam. After survey, the question which appeared  in exam looked little difficult to answer.

For the second exam, I realized this and marked my proficiency level as least second for exam 70-534. The questions which appear in exam weren’t that difficult.

I’m not sure if survey really matters in determining exam question difficultly level, but this is my observation. (This sounds like machine learning to some extent!)

2) Question

There are two type of questions.

Do or Die (I just call like this)

  • Yes, these questions can be answered only once and it gets freeze.  you can’t be looked back or mark them for “Review later” options.
  • This will be mostly yes or no like of questions OR MCQ
  • This will be appear in the start like 4-5 questions and at the end 4-5 questions.

Review enabled questions

  • These will some where 40+ questions
  • Contains
    • Case studies
      • There will be 3 or 4 case studies will be there. The questions will be asked based on the case study. This questions are tricky as the answer lies in the case study it self. if you
      • are confused on two options, then you will have to skim case studies multiple times. I’m pretty sure answer will be present in the question it self.
      • some times, answer what you think may not be correct when you think it as general scenario and as you think with case study scenario perspective. Think answer only with respect to case study perspective.
    • Direct MCQ
      • There will not be any case study for this. Real the question and answer best suited. There will minute differences within options. identity those minute difference to get your answer right
    • Code related
      • There will section where you will have to fill the missing coding part (if you lucky, you may not get these).
      • Below are the practice code you should be familiar
        • Await, Async, key words in .net
        • Know what methods are used for creating service bus queues, storage accounts, blob and table storage clients.
        • For queues, you need know what is SAS token, Peek, Receive, Dequeue operations
    • Arrange them in order steps
      • There will be steps which will be given in the question. which needs to be arranged in order to achieve an objective.
      • Arranging these in the correct order is the most difficult questions (as per me).
      • Again, in few question there will be answers within in the questions. I remember a question where it was stated that “variable employee1 and employee2 are already declared”. so in my answer, I didn’t have to select steps for variable declaration.

Preparation – Technical:

  • Azure batch vs Web jobs vs Azure schedulers
  • Logic apps, service fabric –> This is not present in exam syllabus but you need know what it is. There was one question where this was present as one of the option.
  • Difference Azure queue and Azure Service bus queue.
  • Storage types, blob (page, append), file storage, Vdisk storage
  • what is VMimage,VDisk and VHDx files.
  • Memorize various tier present in azure for storage, VM size (D series, G series and others). there will be minimum 4 approx. question on this.
  • Worker roles, web roles and role instances.
  • Dev test labs
  • Json syntax
  • ARM template syntax – schemas, parameters, output etc.
  • Authentication – SML, OAuth, Kerberos
  • Azure active directory domain services and on-premise and active directory, federation identity providers. DirSync, password sync
  • Role base access control – contributor, owner, reader and few other types
  • Is it necessary to have hand on?
    • Actually, not necessary. If you are going through plural sight videos, there will be demo sections which shows code, azure portal usage,
    • But, you can still create 200$ credit subscription and explore. This will help you remember terminologies easier.
  • Coming to important part, do we need dumps?
    • Yes, it doesn’t matter weather the dumps are valid or not. this gives you practice and help you to understand various types of questions. What i have seen is these dumps are generally only 30 percent valid (if you are lucky may be more).

This article is consequence of two exams 70-532 and 70-534 (replaced by 535). This will be partially applicable for other cloud examination path.

Hope this help in your exams! Good luck.

 

BizTalk

Deleting Isolated host Active instance

declare @IsolatedHostName nvarchar(128)
declare @uidInstanceID uniqueidentifier
declare @uidServiceID uniqueidentifier
declare @fKnownInstance int
declare @spname nvarchar(512)

Begin Tran
set @IsolatedHostName=’BTS_WEBSERVICES_ISOLATED_HOST’
set @uidInstanceID=’d6414769-30c1-41a2-b9ee-f930bfc01ec0′ –InstanceID
set @uidServiceID=’683AEDF1-027D-4006-AE9A-443D1A5746FC’ –ServiceClassID
set @spname= ‘int_AdminTerminateInstance_’ + @IsolatedHostName
exec @spname @uidInstanceID, @uidServiceID, @fKnownInstance OUTPUT
DELETE FROM InstancesPendingOperations WITH (ROWLOCK) WHERE uidInstanceID = @uidInstanceID OPTION (KEEPFIXED PLAN)

Commit Tran

DevOps

Automated Build terminologies

  • Build automation is essentially automating how the software is built instead of manually invoking the compiler. This would be accomplished via tools such as Makefiles or Ant.
  • Deployment automation is less well-define but involves taking your built software and “deploying” or “installing” it on a test or production system.
  • Continuous integration means having an automated process build your software continuously as developers check in code. For example, every 15 to 30 minutes a server might wake up, look for new check-ins, and build the project if any changes were made.
  • Continuous delivery is a combination of CI and DA where the software builds from CI are also deployed to a test system.
Azure Integration Services, BizTalk, Technology and tricks

Basic use cases in XSLT

Basic programming use cases in XSLT
Use case Relevant XSLT elements
Creating nodes xsl:element, xsl:attribute, xsl:text, xsl:comment, xsl:processing-instruction
Copying nodes xsl:copy-of, xsl:copy
Repetition (looping) xsl:for-each
Sorting xsl:sort
Conditional processing xsl:choose, xsl:if
Computing or extracting a value xsl:value-of
Defining variables and parameters xsl:variable, xsl:param
Defining and calling subprocedures (named templates) xsl:template, xsl:call-template
Defining and applying template rules xsl:template, xsl:apply-templates, xsl:apply-imports
Numbering and number formatting xsl:number, xsl:decimal-format
Debugging xsl:message
Combining stylesheets (modularization) xsl:import, xsl:include
Compatibility xsl:fallback
Building lookup indexes xsl:key
XSLT code generation xsl:namespace-alias
Output formatting xsl:output
Whitespace stripping xsl:strip-space, xsl:preserve-space