Tag Archives: powershell

How to get Tenant ID from Subscription ID in Azure using PowerShell

This is a series of blog posts: Part 1: using PowerShell Part 2: using ADAL Part 3: using MSAL In order to do this, you’ll need: Call this Azure Resource Manager API without authentication, I suggest always use the latest … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

How to get secret from Key Vault using PowerShell and Managed Identity

First you need to acquire a token using Managed Identity by calling the local Instance Metadata Service (IMDS) endpoint: Note that audience must match the service you’re calling and is different from example calling ARM. Then call the Key Vault … Continue reading

Posted in Programming | Tagged , , | Leave a comment

How to assigned permissions for user-assigned managed identity on multiple subscriptions in bulk

First get the subscriptions you want to assign permissions on: Then get the client id of the identity you to assign permissions for: Now perform the actual permissions assignment: That’s it, folks!

Posted in Programming | Tagged , | Leave a comment

How to enable automatic clean up of provisioned application types on a Service Fabric cluster

As time goes by and you deploy applications, a new build every time what means a new application type is getting provisioned. Application packages are piling up and after some time old versions become just a clutter that eats up … Continue reading

Posted in Infrastructure | Tagged , , | Leave a comment

How to find out the latest ARM api version for given resource type

If you’d like to find this out, for instance, for Service Fabric applications, then use this query: which would yield this result: 2017-07-01-preview2016-09-012016-03-01 what means that you now can go to the GitHub repo with all ARM schemas and find … Continue reading

Posted in Infrastructure | Tagged , , | Leave a comment

How to package Service Fabric application into SFPKG using custom MSBuild task

This task wouldn’t require much efforts but: Service Fabric doesn’t support packaging its “package” (which is not a real package but just a directory) into .sfpkg out-of-the-box. Only suggests to use ZipFile.CreateFromDirectory. MSBuildTasks doesn’t support .NET Core so we can’t … Continue reading

Posted in Infrastructure | Tagged , , | 1 Comment

How to remove ARM resources for Service Fabric application and service using PowerShell

First you need to remove the resource corresponding to the application itself: And then the resource corresponding to the service:

Posted in Programming | Tagged , , | Leave a comment

How to call LINQ extension methods such as Where and ToDictionary using PowerShell

If you have IEnumerable<XElement> and want to call various LINQ extension methods such as Enumerable.Where() or ​​Enumerable.ToDictionary() on it using PowerShell then first load the necessary assemblies: And here’s the code for Where(): and for ToDctionary():

Posted in Programming | Tagged , | Leave a comment

The BuildLayout of the application is invalid. Code is missing for service

If you’re getting these very rare but still mysterious errors: Started executing script ‘Deploy-FabricApplication.ps1’. Test-ServiceFabricApplicationPackage : The BuildLayout of the application in c:\Temp\TestApplicationPackage_3811564851592\icw0q1rk.bus\Release is invalid. Code is missing for service MyWebApiPkg. or Register-ServiceFabricApplicationType : The BuildLayout of the application in … Continue reading

Posted in Programming | Tagged , | Leave a comment

How to deploy Azure Data Factory pipeline and its dependencies programatically using PowerShell

Since ADF doesn’t provide a built-in way for automated deployment, in order to do this you have to write a custom script. Then you can run it on build server such as VSTS or TeamCity. If you’re in the interactive … Continue reading

Posted in Programming | Tagged , | 44 Comments