How to download a GitHub Repository using PowerShell

How to download a GitHub Repository using PowerShell

I am automating specific tasks related to my Microsoft Integration, Azure, Office 365, and much more Stencils Pack for Visio project: I started in my last blog post with two simple tasks:

  • Standardize all SVG filenames;
  • List all the detected duplicate files;

And now, I am trying to add more functionalities like: 

  • Automatically install (configure) all the Visio files (*.vssx), so that next time you open Visio, they will be there available;
  • And also the possibility to download the most recent version from GitHub and install it locally;

Well, the first task is quite simple, you just need to locate all the *.vssx files and copy to the folder “C:Usersyou_userDocumentsMy Shapes” (that is the default folder for the Visio custom shapes)

#########################################################
#                                                       #
# Install Microsoft Integration & Azure Stencils Pack   #
# Author: Sandro Pereira                                #
#                                                       #
#########################################################

[String]$location = Split-Path -Parent $PSCommandPath
[String]$destination = [environment]::getfolderpath('mydocuments') + "My Shapes"

$files = Get-ChildItem $location -recurse -force -Filter *.vssx
foreach($file in $files)
{
    if($file.PSPath.Contains("Previous Versions") -eq $false)
    {
        Copy-Item -Path $file.PSPath -Destination $destination -force
    }
}

You can download this script here: Install Microsoft Integration & Azure Stencils Pack.

The second part is a little trick. I found many resources while searching on the internet, but none was what I intended to do. Some were quite nice, but we could easily reach the API Rate limit that is 60 requests per hour for unauthenticated requests or 5000 requests per hour if you use Basic Authentication or OAuth. Or it simply didn’t unzip properly.

I want to archive a simple way to download a full GitHub repository and unzip it locally. Simple as going in the browser and select Code > Download ZIP, that’s it!

And to archive that you can use two ways:

  • using the following URL structure:
    • https://github.com/[owner]/[repo-name]/archive/[Branch].zip
    • This is exactly what Code > Download ZIP does.
  • or using the GitHub API using the following URL structure:
    • https://api.github.com/repos/[owner]/[repo-name]/zipball/Branch]

Since I was doing all this work, I also decide to make it available a generic PowerShell function that will allow you to download any GitHub Repository.

######################################################################
#                                                                    #
# Download and Unzip GitHub Repository                               #
# Author: Sandro Pereira                                             #
#                                                                    #
######################################################################

function DownloadGitHubRepository 
{ 
    param( 
       [Parameter(Mandatory=$True)] 
       [string] $Name, 
        
       [Parameter(Mandatory=$True)] 
       [string] $Author, 
        
       [Parameter(Mandatory=$False)] 
       [string] $Branch = "master", 
        
       [Parameter(Mandatory=$False)] 
       [string] $Location = "c:temp" 
    ) 
    
    # Force to create a zip file 
    $ZipFile = "$location$Name.zip" 
    New-Item $ZipFile -ItemType File -Force

    #$RepositoryZipUrl = "https://github.com/sandroasp/Microsoft-Integration-and-Azure-Stencils-Pack-for-Visio/archive/master.zip"
    $RepositoryZipUrl = "https://api.github.com/repos/$Author/$Name/zipball/$Branch"  
    # download the zip 
    Write-Host 'Starting downloading the GitHub Repository'
    Invoke-RestMethod -Uri $RepositoryZipUrl -OutFile $ZipFile
    Write-Host 'Download finished'

    #Extract Zip File
    Write-Host 'Starting unzipping the GitHub Repository locally'
    Expand-Archive -Path $ZipFile -DestinationPath $location -Force
    Write-Host 'Unzip finished'
    
    # remove the zip file
    Remove-Item -Path $ZipFile -Force 
}

Download

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

Standardize SVG Filenames with PowerShellHow to Download a GitHub Repository with PowerShell
GitHub

The post How to download a GitHub Repository using PowerShell appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk360 GitHub Project

BizTalk360 GitHub Project

Introduction

BizTalk360 is the one-stop tool to manage operations, monitoring and analytics of your BizTalk environment.  Over 80+ features in the product bring all the BizTalk Tools like EDI, ESB, Business Rules, BAM, and the BizTalk Health Monitor. It is a matured product with these features included of which there have been 50+ iterations of product updates. User Access Policies with governance audit (Security), Operational Tool Integration, Monitoring, and Analytics are among the BizTalk360 core capabilities. BizTalk360 has brought important business scenarios into the product like:

  • Auto-healing of BizTalk Artifacts
  • Automated actions on Suspended Instances
  • Process Monitoring and Data Monitoring

 These capabilities make BizTalk360 the must-have tool to manage the BizTalk Server.

Customization in BizTalk360

BizTalk360 has provided solutions to common Integration scenarios (BizTalk, Azure). In addition to the above-mentioned features, BizTalk360 has provided the opportunity to integrate custom solutions into the product through:

  • Custom Notification Channels
  • Custom Widgets
  • Create Alarm Tool

BizTalk360-GitHub

Custom Notification Channels and Custom Widgets are bundled into the product, during the major update of v8.0.  Users are taking advantage of these features, by customizing alert notification to their preferred channels and visualize their important data in BizTalk360 Dashboard through Custom Widgets.

The source code of such customized solutions (Notification channels, Widgets and Alarm Creation Tools) is available in our GitHub Project.

Users can utilize the source code to create new customized solutions or extend their existing solution to meet their business requirements.

Users can commit their solutions into BizTalk360 GitHub which will benefit other users who follow this channel.

Custom Notification Channels

Custom Notification Channels provide a platform to send alerts to an external system, like your ticketing system, internal databases, calling a REST endpoint, executing a PowerShell script, etc. If you want to know how you can create, customize and configure new or existing custom notification channels, read this article.

 BizTalk360 has out of box solutions for the following Custom Notification Channel:

Users can create their own customized solution for their ticketing systems rather than ServiceNow or trigger activities (PowerShell) based on their business needs. We can see some of the use cases that users can take by customizing the notification channels:

  1. ServiceNow – Customers can extend the BizTalk360 ServiceNow notification channel to add more fields to meet the business process
  2. PowerShell Notification – Users are utilizing this capability to trigger actions when monitoring conditions are violated
    • Start/Stop Host Instances

    • Terminate dehydrated service Instances

    • Terminate messages after X number of days

    • Manage Maintenance mode during BizTalk Deployments

  3. Microsoft Teams – Enhance the Microsoft Teams notification channel to include a message card
  4. SMTP Notification – Users can improve on default notification by using the SMTP Notification Channel to configure Up, AutoCorrect Email separately.

The source code in the GitHub project can be pulled, customize the code to meet your business scenario and then configure it in BizTalk360 to be able to use your custom solutions.

Custom Widgets

Custom Widget is a powerful feature by which users can take advantage in BizTalk360. Customers can integrate their business process flows by using Custom widgets. This allows integrating solutions with BizTalk360 own API’s, as well as third-party API’s (like SalesForce, Power BI, Azure, etc.) and database queries by using the Secure SQL Queries.

Use Cases:

  1. Business Process – Few customers are integrating their business flows using their internal API’s and created custom widgets by which business users take advantage of BizTalk360 dashboard integration
  2. Graphical Representation – Visualize the reports in Solid gauge using High Charts, which is available in BizTalk360
  3. Consolidated View of Monitoring Dashboard – Users are able to customize their monitoring dashboard to a single view, by grouping type of monitors
  4. Secure SQL Query – This provides the opportunity to pull data from other databases into the BizTalk360 dashboard through Secure SQL Queries
  5. Monitoring Status– Many of our users are using dashboards to monitor their business flow integrations. They can create a custom widget and pin it to a dashboard to monitor the integration. You can think of showing the following:
    • Errors & Warnings of an Alarm in a Grid

    • Last Date Time of Errors & Warnings

    • Web Endpoint Monitoring status of an integration

    • Number of Suspended Instances in an alarm

    • Number of messages processed in an application

  6. Monitoring SQL JobsSQL Jobs are monitored through BizTalk360 API’s by creating a custom widget

custom-widget

status-monitor

Alarm Configuration

Another example of running third-party executables is the creation of BizTalk360 alarms. Normally, you’ll have to do this manually after each deployment of a new or changed BizTalk application. This too can be a time-consuming and error-prone task.

By using BTDF and a tool called BT360Deploy, you can automate the creation of alarms during the deployment of your BizTalk application.

In complex BizTalk environments, creating Alarms and mapping artifacts to monitor is a tedious process. To overcome this challenge, our Technical Lead (Lex) has written an article to configure BizTalk Artifacts for monitoring through the Alarm Creation Tool. In that article, he explained how the BizTalk Deployment Framework (BTDF) is integrated with BizTalk360 Monitoring.

Conclusion

Users can take advantage of custom solutions using Custom Notification Channel, Custom Widgets and Alarm Creation Tools.  Customers get the maximum benefits out of BizTalk360 when creating custom solutions.

The post BizTalk360 GitHub Project appeared first on BizTalk360.

BizTalk Server Community Extensions Utility Packs GitHub Repository

BizTalk Server Community Extensions Utility Packs GitHub Repository

During the last years I developer and make it available several BizTalk projects like tools, components (functoids, adapters, …) or samples on several platforms like CodePlex, Microsoft MSDN Code Sample or Microsoft TechNet Gallery. And because CodePlex shut down last year, many people were asking me if I will make it available that existing CodePlex projects on GitHub.

Well, I’m happy to announce the BizTalk Server Community Extensions Utility Packs GitHub Repository where I will make it available all my BizTalk Server related community projects or samples.

BizTalk Server Community Extensions Utility Packs GitHub Repository

Initial, my intention was to start to contribute into the Microsoft Integration Repository on GitHub and put everything there but I found out they have several restrictions and that will not be practical or possible… so, I decided to create a repository where everyone can easily contribute and be a central community place for any kind of BizTalk Server Resources:

  • Sample Projects
  • Custom Adapters
  • Custom Pipeline Components
  • Custom Pipelines
  • Schemas
  • Custom Functoids
  • Tools
  • SQL and/or PowerShell Scripts
  • PowerPoints
  • and so on

The main goal is for this repository to be a central public repository for Microsoft BizTalk Server open source community resources.

For now, it has available:

  • BizTalk Mapper Extensions UtilityPack for BizTalk Server 2010, 2013, 2013 R2 and 2016
  • BizTalk Mapper Extensions Functoid Wizard for BizTalk Server 2010
  • Microsoft Message Queuing Testing Tool

Soon, I will be adding more projects and samples and create some documentation regarding the projects available and credits to the authors.

JOIN ME IN THIS INITIATIVE! And add your projects to this common repository.

BizTalk Server Community Extensions Utility Packs GitHub Repository:
BizTalk Server Community Extensions Utility Packs GitHub Repository
GitHub

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

Introducing BTFGui

Today I published one of my little projects on GitHub. It’s called BTFGui and in essence it is just a simple GUI around the BizTalkFactory Management Automation (SDK) to do some basic BizTalk Administration.

Currently it has the following features:

  • Stop/Restart HostInstances
  • Stop/Restart Applications
  • Remote Applications
  • Export Application Bindings
  • Terminate Suspended Instances

You can find It here on GitHub.

The main reason why I put this little thing together is simple: the BizTalk Administration Console can be very slow and time wasting if you just want to restart a hostinstance or export a binding. Therefore I created BTFGui and I can tell you that it saves me a lot of time when developing on my local BizTalk Server instance.

Introducing BTFGui

Today I published one of my little projects on GitHub. It’s called BTFGui and in essence it is just a simple GUI around the BizTalkFactory Management Automation (SDK) to do some basic BizTalk Administration.

Currently it has the following features:

  • Stop/Restart HostInstances
  • Stop/Restart Applications
  • Remote Applications
  • Export Application Bindings
  • Terminate Suspended Instances

You can find It here on GitHub.

The main reason why I put this little thing together is simple: the BizTalk Administration Console can be very slow and time wasting if you just want to restart a hostinstance or export a binding. Therefore I created BTFGui and I can tell you that it saves me a lot of time when developing on my local BizTalk Server instance.