<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jonathan Medd&#039;s Blog</title>
	<atom:link href="https://www.jonathanmedd.net/feed" rel="self" type="application/rss+xml" />
	<link>https://www.jonathanmedd.net</link>
	<description>Automating anything that moves.....</description>
	<lastBuildDate>Tue, 04 Jan 2022 18:14:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://www.jonathanmedd.net/wp-content/uploads/2020/11/cropped-ScottPilgrim-32x32.png</url>
	<title>Jonathan Medd&#039;s Blog</title>
	<link>https://www.jonathanmedd.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Automating SonarCloud with PowerShell – Part 3 Onboarding a User</title>
		<link>https://www.jonathanmedd.net/2022/01/automating-sonarcloud-with-powershell-part-3-onboarding-a-user.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Tue, 04 Jan 2022 18:10:51 +0000</pubDate>
				<category><![CDATA[API]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sonarcloud]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5894</guid>

					<description><![CDATA[Warning: this post contains unsupported API calls, so use at your own risk Similar to the situation in Part 2 for onboarding a project into SonarCloud, onboarding a user into an organization is also not supported via the public API. In the API documentation there is no entry for api/organizations This was confirmed by a &#8230; <a href="https://www.jonathanmedd.net/2022/01/automating-sonarcloud-with-powershell-part-3-onboarding-a-user.html" class="more-link">Continue reading <span class="screen-reader-text">Automating SonarCloud with PowerShell – Part 3 Onboarding a User</span></a>]]></description>
										<content:encoded><![CDATA[
<p><strong>Warning: this post contains unsupported API calls, so use at your own risk</strong></p>



<p>Similar to the situation in <a rel="noreferrer noopener" href="https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html" target="_blank">Part 2</a> for onboarding a project into SonarCloud, onboarding a user into an organization is also not supported via the public API.</p>



<p>In the API documentation there is no entry for <strong>api/organizations</strong></p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-1.png"><img decoding="async" width="274" height="402" src="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-1.png" alt="" class="wp-image-5896" srcset="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-1.png 274w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-1-204x300.png 204w" sizes="(max-width: 274px) 100vw, 274px" /></a></figure>



<p>This was confirmed by a <a rel="noreferrer noopener" href="https://community.sonarsource.com/t/api-for-organizations/24930/3" target="_blank">community posting</a> and unfortunately did not appear on the roadmap:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-5.png"><img decoding="async" loading="lazy" width="822" height="282" src="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-5.png" alt="" class="wp-image-5902" srcset="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-5.png 822w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-5-300x103.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-5-768x263.png 768w" sizes="(max-width: 822px) 100vw, 822px" /></a></figure>



<h2>Back to Chrome Developer Tools</h2>



<p>So in the same way as in <a rel="noreferrer noopener" href="https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html" target="_blank">Part 2</a>  I used Chrome Developer Tools to monitor what happens in the SonarCloud UI when adding a member to an organization:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-2.png"><img decoding="async" loading="lazy" width="540" height="214" src="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-2.png" alt="" class="wp-image-5897" srcset="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-2.png 540w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-2-300x119.png 300w" sizes="(max-width: 540px) 100vw, 540px" /></a></figure>



<p>We can see that a URL of&nbsp;<code>/api/organizations/add_member</code>&nbsp;is used:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-3.png"><img decoding="async" loading="lazy" width="505" height="167" src="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-3.png" alt="" class="wp-image-5898" srcset="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-3.png 505w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-3-300x99.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></a></figure>



<p>The payload contained two items:</p>



<ul><li>login – the GitLab user id</li><li>organization – the SonarCloud organization</li></ul>



<p>Consequently the&nbsp;A<a rel="noreferrer noopener" href="https://github.com/jonathanmedd/PSSonarCloud/blob/main/src/Functions/Public/Organizations/Add-SonarCloudOrganizationMember.ps1" target="_blank">dd-SonarCloudOrganizationMember</a>&nbsp;function was born and we can now fully onboard a user to an organization with the following:</p>



<script src="https://gist.github.com/jonathanmedd/606fb5d352261388bc9c1abf0ad56fc7.js"></script>



<p>The user is successfully onboarded to the organisation:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-4.png"><img decoding="async" loading="lazy" width="456" height="288" src="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-4.png" alt="" class="wp-image-5899" srcset="https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-4.png 456w, https://www.jonathanmedd.net/wp-content/uploads/2022/01/image-4-300x189.png 300w" sizes="(max-width: 456px) 100vw, 456px" /></a></figure>



<p></p>



<ul><li><a rel="noreferrer noopener" href="http://jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html" target="_blank">Automating SonarCloud with PowerShell – Part 1 Introduction</a></li><li><a href="https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html" target="_blank" rel="noreferrer noopener">Automating SonarCloud with PowerShell – Part 2 Onboarding a Project</a></li><li>Automating SonarCloud with PowerShell – Part 3 Onboarding a User</li></ul>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automating SonarCloud with PowerShell – Part 2 Onboarding a Project</title>
		<link>https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Wed, 22 Dec 2021 11:57:58 +0000</pubDate>
				<category><![CDATA[API]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sonarcloud]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5881</guid>

					<description><![CDATA[Warning: this post contains unsupported API calls, so use at your own risk One of the main reasons I started looking at the SonarCloud api was to be able to automate the onboarding of new GitLab projects into SonarCloud. We didn&#8217;t want to have to do that manually via the UI, rather via a pipeline &#8230; <a href="https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html" class="more-link">Continue reading <span class="screen-reader-text">Automating SonarCloud with PowerShell – Part 2 Onboarding a Project</span></a>]]></description>
										<content:encoded><![CDATA[
<p></p>



<p><strong>Warning: this post contains unsupported API calls, so use at your own risk</strong></p>



<p>One of the main reasons I started looking at the SonarCloud api was to be able to automate the onboarding of new GitLab projects into SonarCloud. We didn&#8217;t want to have to do that manually via the UI, rather via a pipeline job. In <a rel="noreferrer noopener" href="https://www.jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html" target="_blank">part 1 of this series</a> I demonstrated the basics of the API and the <a href="https://github.com/jonathanmedd/PSSonarCloud" target="_blank" rel="noreferrer noopener">PSSonarCloud PowerShell module</a>, in part 2 we&#8217;ll look at how to onboard a project into SonarCloud.</p>



<h2>False Start</h2>



<p>Initially this looked like it would be a very straightforward job, the SonarCloud Web Api has <a href="https://sonarcloud.io/web_api/api/projects" target="_blank" rel="noreferrer noopener">documentation for creating a projec</a>t:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image.png"><img decoding="async" loading="lazy" width="835" height="504" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image.png" alt="" class="wp-image-5882" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image.png 835w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-300x181.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-768x464.png 768w" sizes="(max-width: 835px) 100vw, 835px" /></a></figure>



<p></p>



<p>So as part of the <a rel="noreferrer noopener" href="https://github.com/jonathanmedd/PSSonarCloud" target="_blank">PSSonarCloud module</a> I added a function &#8220;`<a rel="noreferrer noopener" href="https://github.com/jonathanmedd/PSSonarCloud/blob/main/src/Functions/Public/Projects/New-SonarCloudProject.ps1" target="_blank">New-SonarCloudProject</a> . You could use it as the following to create a project, all you need is a SonarCloud API key with permission to create a project, then the SonarCloud organisation, GitLab project name and project id:</p>



<script src="https://gist.github.com/jonathanmedd/6d7acc4dc2962ffee32398479fccc543.js"></script>



<p>The project will appear in SonarCloud and all looks good:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-2.png"><img decoding="async" loading="lazy" width="353" height="173" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-2.png" alt="" class="wp-image-5884" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-2.png 353w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-2-300x147.png 300w" sizes="(max-width: 353px) 100vw, 353px" /></a></figure>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-1.png"><img decoding="async" loading="lazy" width="232" height="148" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-1.png" alt="" class="wp-image-5883"/></a></figure>



<p></p>



<p>However, an issue will arise when you attempt to run some analysis against the project, it will fail and complain that the SonarCloud project is not integrated with your repo.</p>



<p>I discovered via a <a rel="noreferrer noopener" href="https://community.sonarsource.com/t/how-do-i-script-linking-a-sonarcloud-project-to-a-bitbucket-cloud-repo/13788/7" target="_blank">community forum post</a> and an observation in the UI that the API call above does not include the integration with the code repo &#8211; compare that project with a project which was onboarded via the UI and it displays integration with GitLab:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-3.png"><img decoding="async" loading="lazy" width="369" height="72" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-3.png" alt="" class="wp-image-5885" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-3.png 369w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-3-300x59.png 300w" sizes="(max-width: 369px) 100vw, 369px" /></a></figure>



<p></p>



<h2>A New Hope</h2>



<p>The forum post suggested an unsupported option would be to examine the API call through browser development tools and use that:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-4.png"><img decoding="async" loading="lazy" width="810" height="234" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-4.png" alt="" class="wp-image-5886" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-4.png 810w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-4-300x87.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-4-768x222.png 768w" sizes="(max-width: 810px) 100vw, 810px" /></a></figure>



<p>So off to Google Chrome development tools we go&#8230;&#8230; </p>



<p>By looking at the API call used when adding a project via the UI, we can see that a URL of <code>/api/alm_integration/provision_projects</code> is used</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-5.png"><img decoding="async" loading="lazy" width="519" height="127" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-5.png" alt="" class="wp-image-5887" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-5.png 519w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-5-300x73.png 300w" sizes="(max-width: 519px) 100vw, 519px" /></a></figure>



<p>The payload contained two items:</p>



<ul><li>installationKeys &#8211; the GitLab project id</li><li>organization &#8211; the SonarCloud organization</li></ul>



<p>Consequently the <a rel="noreferrer noopener" href="https://github.com/jonathanmedd/PSSonarCloud/blob/main/src/Functions/Public/ALMIntegration/New-SonarCloudProjectALMIntegrated.ps1" target="_blank">New-SonarCloudProjectALMIntegrated</a> function was born. So we can now fully onboard a project with the following:</p>



<script src="https://gist.github.com/jonathanmedd/8d7e8850c2f33e934c950f4658a81410.js"></script>



<p>The resultant project has been fully onboarded:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-6.png"><img decoding="async" loading="lazy" width="379" height="80" src="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-6.png" alt="" class="wp-image-5888" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-6.png 379w, https://www.jonathanmedd.net/wp-content/uploads/2021/12/image-6-300x63.png 300w" sizes="(max-width: 379px) 100vw, 379px" /></a></figure>



<ul><li><a rel="noreferrer noopener" href="http://jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html" target="_blank">Automating SonarCloud with PowerShell – Part 1 Introduction</a></li><li>Automating SonarCloud with PowerShell – Part 2 Onboarding a Project</li><li><a href="https://www.jonathanmedd.net/2022/01/automating-sonarcloud-with-powershell-part-3-onboarding-a-user.html" target="_blank" rel="noreferrer noopener">Automating SonarCloud with PowerShell – Part 3 Onboarding a User</a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automating SonarCloud with PowerShell &#8211; Part 1 Introduction</title>
		<link>https://www.jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html</link>
					<comments>https://www.jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html#comments</comments>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Mon, 22 Nov 2021 15:16:46 +0000</pubDate>
				<category><![CDATA[API]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sonarcloud]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5874</guid>

					<description><![CDATA[SonarCloud is the SaaS version of SonarQube, a tool to detect and fix issues in your code by examining code quality and security vulnerabilities. I needed to automate the onboarding of both users and code projects into SonarCloud to take away the need to manually provision these items into the system. SonarCloud has a Web &#8230; <a href="https://www.jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html" class="more-link">Continue reading <span class="screen-reader-text">Automating SonarCloud with PowerShell &#8211; Part 1 Introduction</span></a>]]></description>
										<content:encoded><![CDATA[
<p><a rel="noreferrer noopener" href="https://sonarcloud.io/" target="_blank">SonarCloud</a> is the SaaS version of <a rel="noreferrer noopener" href="https://www.sonarqube.org/" target="_blank">SonarQube</a>, a tool to detect and fix issues in your code by examining code quality and security vulnerabilities. I needed to automate the onboarding of both users and code projects into <a rel="noreferrer noopener" href="https://sonarcloud.io/" target="_blank">SonarCloud</a> to take away the need to manually provision these items into the system.</p>



<p><a rel="noreferrer noopener" href="https://sonarcloud.io/" target="_blank">SonarCloud</a>  has a <a rel="noreferrer noopener" href="https://sonarcloud.io/web_api/" target="_blank">Web API</a> which facilitated a lot of what I needed to achieve, however with some significant gaps which initially appeared to mean some of the onboarding would need to still be manual. Coming up in Part 2 and later of this tale will feature how I reverse engineered the <a rel="noreferrer noopener" href="https://sonarcloud.io/web_api/" target="_blank">Web API</a> to fill in the missing parts of the puzzle, but in Part 1 I&#8217;ll focus on an introduction of the basics.</p>



<h2>Pre-Requisites</h2>



<p>The automation was carried out with PowerShell 7.x+. An API key for the SonarCloud <a rel="noreferrer noopener" href="https://sonarcloud.io/web_api/" target="_blank">Web API</a> is required and can be generated from the <a rel="noreferrer noopener" href="https://sonarcloud.io/account/security/" target="_blank">security page of your SonarCloud account</a>:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image.png"><img decoding="async" loading="lazy" width="640" height="356" src="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image.png" alt="" class="wp-image-5875" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image.png 640w, https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-300x167.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a></figure>



<p></p>



<p>Initially I thought I would only need a few API calls, however it turned into many, so I ended up creating a PowerShell module, <a rel="noreferrer noopener" href="https://github.com/jonathanmedd/PSSonarCloud" target="_blank">PSSonarCloud</a>, to facilitate easy re-use of similar calls.</p>



<h2>Getting Started</h2>



<p>Install PSSonarCloud from the PowerShell Gallery:</p>



<script src="https://gist.github.com/jonathanmedd/43f5548267ede815eb82d1bdca6e010a.js"></script>



<p>Supply your SonarCloud API key to create a connection variable:</p>



<script src="https://gist.github.com/jonathanmedd/5d383595bf54cda70b56bafa43ef8935.js"></script>



<p>Retrieve a list of projects belonging to your SonarCloud organization:</p>



<script src="https://gist.github.com/jonathanmedd/fa0bccf34f5511fdefd1ff86beef3a64.js"></script>



<p> Retrieve a list of users belonging to your SonarCloud organization: </p>



<script src="https://gist.github.com/jonathanmedd/000e8ac5bc0e77c1f3051a31361d033d.js"></script>



<h2>Going Further</h2>



<p>The module currently contains 15 functions for working with the API:</p>



<script src="https://gist.github.com/jonathanmedd/ba2f3482823ea094f02a42f75dd247bf.js"></script>



<p>This only covers a relatively small part of the API, however as per most of my other PowerShell modules the functions are wrappers around a single function <code>Invoke-SonarCloudRestMethod</code> which means should you need to work with an API call that is not currently covered by PSSonarCloud then it should be straightforward.</p>



<p>For example the following API call to list the branches of a project is not part of PSSonarCloud yet:</p>



<figure class="wp-block-image size-full"><a href="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-1.png"><img decoding="async" loading="lazy" width="1017" height="237" src="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-1.png" alt="" class="wp-image-5876" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-1.png 1017w, https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-1-300x70.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2021/11/image-1-768x179.png 768w" sizes="(max-width: 1017px) 100vw, 1017px" /></a></figure>



<p></p>



<p>The following code would get you there though:</p>



<script src="https://gist.github.com/jonathanmedd/f02f36cf7be8fb0aef575172b15d8c35.js"></script>



<ul><li>Automating SonarCloud with PowerShell &#8211; Part 1 Introduction</li><li><a rel="noreferrer noopener" href="https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html" target="_blank">Automating SonarCloud with PowerShell – Part 2 Onboarding a Project</a></li><li><a href="https://www.jonathanmedd.net/2022/01/automating-sonarcloud-with-powershell-part-3-onboarding-a-user.html" target="_blank" rel="noreferrer noopener">Automating SonarCloud with PowerShell – Part 3 Onboarding a User</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jonathanmedd.net/2021/11/automating-sonarcloud-with-powershell-part-1-introduction.html/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Authenticating to GitHub using Git for Windows and a Personal Access Token fails</title>
		<link>https://www.jonathanmedd.net/2021/02/authenticating-to-github-using-git-for-windows-and-a-personal-access-token-fails.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Thu, 04 Feb 2021 17:59:58 +0000</pubDate>
				<category><![CDATA[git]]></category>
		<category><![CDATA[GitHub]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5861</guid>

					<description><![CDATA[While following this guide to migrate to using multiple GitHub HTTPS accounts on Windows from a single user account I have used for years, I had to remove my existing GitHub.com credentials from Windows Credential Manager. When re-authenticating via the prompted login window: to existing repos on GitHub.com using an existing Personal Access Token or &#8230; <a href="https://www.jonathanmedd.net/2021/02/authenticating-to-github-using-git-for-windows-and-a-personal-access-token-fails.html" class="more-link">Continue reading <span class="screen-reader-text">Authenticating to GitHub using Git for Windows and a Personal Access Token fails</span></a>]]></description>
										<content:encoded><![CDATA[
<p>While following this guide to migrate to using <a href="https://dev.to/configcat/lazy-man-s-guide-multiple-github-https-accounts-on-windows-2mad">multiple GitHub HTTPS accounts on Windows</a> from a single user account I have used for years, I had to remove my existing GitHub.com credentials from Windows Credential Manager. When re-authenticating via the prompted login window:</p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="380" height="374" src="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-2.png" alt="" class="wp-image-5864" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-2.png 380w, https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-2-300x295.png 300w" sizes="(max-width: 380px) 100vw, 380px" /></figure>



<p>to existing repos on GitHub.com using an existing Personal Access Token or authenticating to a new repo using a different account on an instance of GitHub Enterprise using a new Personal Access Token, I would receive a combination of the following errors:</p>



<p><code>repository not found</code></p>



<p><code>login failed use ctrl+c to cancel basic credential prompt</code></p>



<p>Turns out the GitHub <a href="https://developer.github.com/changes/2020-02-14-deprecating-password-auth/">recently deprecated basic authentication using a username and password</a> in favour of a personal access token. I couldn&#8217;t see why this was causing me an issue since I was trying to use a personal access token.</p>



<p>This <a href="https://stackoverflow.com/questions/64962533/logon-failed-use-ctrlc-to-cancel-basic-credential-prompt">StackOverflow post</a> cleared things up. A later version of git for Windows is required in order to use the new method. Initially I had <code>v2.27.0.windows.1</code> so upgraded to the latest as of writing this post<code> v2.30.0.windows.2</code>. There&#8217;s a clue to some changes during the upgrade process that a new Git Credential Manager will be used:</p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="432" height="199" src="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-3.png" alt="" class="wp-image-5865" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-3.png 432w, https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-3-300x138.png 300w" sizes="(max-width: 432px) 100vw, 432px" /></figure>



<p></p>



<p>After upgrade there is a different dialogue window when authenticating:</p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="406" height="357" src="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-1.png" alt="" class="wp-image-5863" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-1.png 406w, https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-1-300x264.png 300w" sizes="(max-width: 406px) 100vw, 406px" /></figure>



<p></p>



<p>Using the Personal Access Tokens were now successful for me across all repos in GitHub.com and Enterprise.</p>



<p>As a side note, if your GitHub Enterprise uses SSO for authentication then you will need to <code>Enable SSO</code>  for you Personal Access Token</p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="212" height="58" src="https://www.jonathanmedd.net/wp-content/uploads/2021/02/image-4.png" alt="" class="wp-image-5866"/></figure>



<p>You may then be prompted further when accessing a repo for the first time to navigate to a URL to authorise it for that repo via a browser.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PowerShell Brickset Module version 2.0.1+: Downloading Lego Instructions</title>
		<link>https://www.jonathanmedd.net/2021/01/powershell-brickset-module-version-2-0-1-downloading-lego-instructions.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Tue, 19 Jan 2021 17:31:12 +0000</pubDate>
				<category><![CDATA[lego]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5851</guid>

					<description><![CDATA[The most common question I get asked about the PowerShell Brickset Module is how to use it to download the online PDF instructions Lego produce to accompany each set. The Get-BricksetSetInstructions function is what you need for this task. A variation on this question is around Lego sets which contain multiple instruction booklets, since Get-BricksetSetInstructions &#8230; <a href="https://www.jonathanmedd.net/2021/01/powershell-brickset-module-version-2-0-1-downloading-lego-instructions.html" class="more-link">Continue reading <span class="screen-reader-text">PowerShell Brickset Module version 2.0.1+: Downloading Lego Instructions</span></a>]]></description>
										<content:encoded><![CDATA[
<p>The most common question I get asked about the <a href="https://github.com/jonathanmedd/BricksetModule">PowerShell Brickset Module</a> is how to use it to download the online PDF instructions Lego produce to accompany each set. The <code>Get-BricksetSetInstructions</code> function is what you need for this task.</p>



<p>A variation on this question is around Lego sets which contain multiple instruction booklets, since <code>Get-BricksetSetInstructions</code> will return a link to each of the PDFs for that set.</p>



<p>There are some examples in a <a href="https://www.jonathanmedd.net/2016/12/powershell-brickset-module-part-2-downloading-instructions.html">previous article</a> which may cover what you are looking for. However, in this article I&#8217;m providing a better example for the more complex scenario where there is a need for:</p>



<ul><li>Support for Lego sets with multiple PDFs</li><li>Naming the downloaded files to match the Lego set number since the file name on the Lego site gives no indication which set it is for</li></ul>



<p>This example will return all Lego sets with the Theme &#8216;Indiana Jones&#8217; and download instruction PDFs for each one, including those with multiple booklets. You can though use the output from any query with <code>Get-BricksetSet</code>, depending on which sets you need the instructions for.</p>



<p>Note: it&#8217;s using <a href="https://docs.microsoft.com/en-us/powershell/module/bitstransfer/start-bitstransfer?view=win10-ps">Start-BitsTransfer</a> which is Windows only. Replace with the file download command of choice if you&#8217;re on a different OS.</p>



<script src="https://gist.github.com/jonathanmedd/2115a3be60cfe5ce2cd4a1d812cb9e39.js"></script>



<figure class="wp-block-video"><video controls src="https://www.jonathanmedd.net/wp-content/uploads/2021/01/Example-2.mp4"></video></figure>



<p></p>
]]></content:encoded>
					
		
		<enclosure url="https://www.jonathanmedd.net/wp-content/uploads/2021/01/Example-2.mp4" length="2104546" type="video/mp4" />

			</item>
		<item>
		<title>PowerShell Brickset Module: Updated for API v3 and PS 7.1</title>
		<link>https://www.jonathanmedd.net/2021/01/powershell-brickset-module-updated-for-api-v3-and-ps-7-1.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Mon, 18 Jan 2021 15:45:38 +0000</pubDate>
				<category><![CDATA[lego]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5835</guid>

					<description><![CDATA[Brickset recently updated their API to v3 and stopped supporting the previous API v2. After receiving a number of requests to update my PowerShell module for Brickset , (which was developed against v2 and consequently had stopped working), both via a GitHub issue and some direct contact (including, surprisingly to me, internal email at work) &#8230; <a href="https://www.jonathanmedd.net/2021/01/powershell-brickset-module-updated-for-api-v3-and-ps-7-1.html" class="more-link">Continue reading <span class="screen-reader-text">PowerShell Brickset Module: Updated for API v3 and PS 7.1</span></a>]]></description>
										<content:encoded><![CDATA[
<p><a href="https://brickset.com/">Brickset</a> recently updated their API to <a href="https://brickset.com/article/52664/api-version-3-documentation">v3</a> and stopped supporting the previous API v2. After receiving a number of requests to update my <a href="https://github.com/jonathanmedd/BricksetModule">PowerShell module for Brickset</a> , (which was developed against v2 and consequently had stopped working), both via a <a href="https://github.com/jonathanmedd/BricksetModule/issues/20">GitHub issue</a> and some direct contact (including, surprisingly to me, internal email at work) I decided I&#8217;d better put some effort into updating it.</p>



<p>I&#8217;d had a quick look at the <a href="https://brickset.com/article/52664/api-version-3-documentation">v3 API</a> not long after it had been made available, and as far as I remember it was still only SOAP based. This had put me off updating the PowerShell module, since I had wanted to also support PowerShell core and there is still no SOAP support in PowerShell core, i.e. no <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-webserviceproxy?view=powershell-5.1">New-WebServiceProxy</a> available  &#8211; see <a href="https://github.com/PowerShell/PowerShell/issues/2240">here</a> and <a href="https://github.com/PowerShell/PowerShell/issues/9838">here</a>. The previous version of the module was built entirely around using <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-webserviceproxy?view=powershell-5.1">New-WebServiceProxy</a> .</p>



<p>However, when I looked again in December 2020 following more external prompting I noticed on the API documentation page that there was support for REST as well as SOAP:</p>



<figure class="wp-block-image size-large"><a href="https://brickset.com/api/v3.asmx?op=getSets"><img decoding="async" loading="lazy" width="758" height="283" src="https://www.jonathanmedd.net/wp-content/uploads/2021/01/image.png" alt="" class="wp-image-5836" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/01/image.png 758w, https://www.jonathanmedd.net/wp-content/uploads/2021/01/image-300x112.png 300w" sizes="(max-width: 758px) 100vw, 758px" /></a></figure>



<p></p>



<p>This meant that it was possible to use Invoke-RestMethod instead of <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-webserviceproxy?view=powershell-5.1">New-WebServiceProxy</a> and after some basic experimenting I went with the second option from the above screenshot to use HTTP POST and Content-Type set to <code>application/x-www-form-urlencoded</code> &#8211;  which by the way I discovered as part of this exercise is the default when specifying the POST method with Invoke-RestMethod and no Content-Type set:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.1"><img decoding="async" loading="lazy" src="https://www.jonathanmedd.net/wp-content/uploads/2021/01/image-1.png" alt="" class="wp-image-5838" width="679" height="120" srcset="https://www.jonathanmedd.net/wp-content/uploads/2021/01/image-1.png 1004w, https://www.jonathanmedd.net/wp-content/uploads/2021/01/image-1-300x53.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2021/01/image-1-768x136.png 768w" sizes="(max-width: 679px) 100vw, 679px" /></a></figure>



<p>So the Brickset Module now contains a wrapper for Invoke-RestMethod, Invoke-BricksetRestMethod, which makes it easy to work with the API. For example to <a href="https://brickset.com/api/v3.asmx?op=getThemes">getThemes</a> :</p>



<script src="https://gist.github.com/jonathanmedd/780eb4d3366a9813142caaa64857968d.js"></script>



<p>The rest of the functions are built using a similar pattern, some more complex where a more complicated body section is required to be sent.</p>



<p>There is also no more $Global:bricksetConnection to contain the API key and UserHash we need to make REST calls, it&#8217;s now available to the module via $Script:bricksetConnection. A security improvement I learnt about from an <a href="https://github.com/jakkulabs/PowervRA/issues/227">issue raised during PowervRA development</a> &#8211; using script scope in a module is effectively module scope.</p>



<p>In addition I took the opportunity to re-use  and update the Azure Pipelines CI/CD work <a href="https://twitter.com/_chelnak">Craig</a> had done for us in <a href="https://github.com/jakkulabs/PowervRA/blob/master/azure-pipelines.yml">PowervRA</a> and <a href="https://github.com/jonathanmedd/BricksetModule/blob/master/azure-pipelines.yml">apply it to this module</a> which brings the following benefits:</p>



<ul><li>Builds the Module psd1 and psm1 files from the src folder</li><li>Carries out PowerShell Script Analyzer tests</li><li>Publishes the module to the PowerShell Gallery</li><li>Creates a GitHub release</li></ul>



<p>This means I can carry out any future updates to this module quicker and easier. Publishing a new version is as simple as creating a tag in the repo and the pipeline does everything else.</p>



<p>Version 2.0.1 of the Brickset module is now available from <a href="https://github.com/jonathanmedd/BricksetModule/releases/tag/v2.0.1">GitHub</a> or the <a href="https://www.powershellgallery.com/packages/Brickset/2.0.1">PowerShell Gallery</a> via:</p>



<script src="https://gist.github.com/jonathanmedd/a02caf2409abd9f51af5d5074adcf878.js"></script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>HashiCorp Certified: Terraform Associate &#8211; Exam Experience</title>
		<link>https://www.jonathanmedd.net/2020/11/hashicorp-certified-terraform-associate-exam-experience.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Mon, 02 Nov 2020 17:13:32 +0000</pubDate>
				<category><![CDATA[terraform]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5825</guid>

					<description><![CDATA[A few weeks ago I took the HashiCorp Certified: Terraform Associate Exam. As part of a learning exercise to get more experience with this technology, having had some basic hands-on experience I booked the exam a short while in advance to have a target to focus the learning. I used a combination of the online &#8230; <a href="https://www.jonathanmedd.net/2020/11/hashicorp-certified-terraform-associate-exam-experience.html" class="more-link">Continue reading <span class="screen-reader-text">HashiCorp Certified: Terraform Associate &#8211; Exam Experience</span></a>]]></description>
										<content:encoded><![CDATA[
<p>A few weeks ago I took the <a href="https://www.hashicorp.com/certification/terraform-associate">HashiCorp Certified: Terraform Associate Exam</a>. As part of a learning exercise to get more experience with this technology, having had some basic hands-on experience I booked the exam a short while in advance to have a target to focus the learning.</p>



<p>I used a combination of the <a href="https://learn.hashicorp.com/collections/terraform/certification">online certification guide at Hashicorp</a> and a few courses available from Pluralsight by <a href="https://twitter.com/Ned1313">Ned Bellavance</a>:</p>



<ul><li><a href="https://app.pluralsight.com/library/courses/getting-started-terraform/table-of-contents">Terraform &#8211; Getting Started</a></li><li><a href="https://app.pluralsight.com/library/courses/terraform-deep-dive/table-of-contents">Terraform Deep Dive</a></li><li><a href="https://app.pluralsight.com/library/courses/implementing-terraform-microsoft-azure/table-of-contents">Implementing Terraform on Microsoft Azure</a></li></ul>



<p>The guide at Hashicorp was excellent for covering the basics with a particular focus on the exam topics. I followed along using test AWS and Azure subscriptions I have access to in order to get more hands-on use. In addition, I found all three Pluralsight courses excellent not just in terms of preparing for the exam, but also had a wider scope and helped better prepare for some real world experience I needed for a work project.</p>



<p>Finally, I used some practice questions from<a href="https://www.udemy.com/course/terraform-associate-practice-exam/"> this course on Udemy</a> which gave a good impression of the type and level of difficulty of questions to expect on the exam.</p>



<p>The exam itself was online given the current issues with accessing physical test centres. Based off my previous experience with taking a <a href="https://www.jonathanmedd.net/2020/04/az-400-azure-devops-exam-experience.html">Microsoft exam online </a>and a good experience with this Hashicorp exam, I think any future exams I take will be online rather than the effort needed to get to a test centre, which for me is typically a 2 hour drive away.</p>



<p>Happy to report that the exam was a success <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="401" height="369" src="https://www.jonathanmedd.net/wp-content/uploads/2020/11/image.png" alt="" class="wp-image-5826" srcset="https://www.jonathanmedd.net/wp-content/uploads/2020/11/image.png 401w, https://www.jonathanmedd.net/wp-content/uploads/2020/11/image-300x276.png 300w" sizes="(max-width: 401px) 100vw, 401px" /></figure>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Combine Two JSON Files With PowerShell</title>
		<link>https://www.jonathanmedd.net/2020/04/combine-two-json-files-with-powershell.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Fri, 24 Apr 2020 10:52:23 +0000</pubDate>
				<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5817</guid>

					<description><![CDATA[Over the years I&#8217;ve used a few different methods to combine two JSON files using PowerShell, but today I found a neat way to do it, so thought I would document it here for easy recall next time I need to do it. Consider two basic JSON files to use for an example: It&#8217;s easy &#8230; <a href="https://www.jonathanmedd.net/2020/04/combine-two-json-files-with-powershell.html" class="more-link">Continue reading <span class="screen-reader-text">Combine Two JSON Files With PowerShell</span></a>]]></description>
										<content:encoded><![CDATA[
<p>Over the years I&#8217;ve used a few different methods to combine two JSON files using PowerShell, but today I found a neat way to do it, so thought I would document it here for easy recall next time I need to do it.</p>



<p>Consider two basic JSON files to use for an example:</p>



<script src="https://gist.github.com/jonathanmedd/cc4a2c632e67841012f8f87d8ecf70e5.js"></script>



<script src="https://gist.github.com/jonathanmedd/ceb0e09bdad4c082fe02e210825d37c8.js"></script>



<p>It&#8217;s easy to start working with them as objects in PowerShell, but I always forget that you can&#8217;t then just concatenate them together since they are PSCustomObjects:</p>



<script src="https://gist.github.com/jonathanmedd/87feda807eb9aab7216788c40e642690.js"></script>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="897" height="116" src="https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-1.png" alt="" class="wp-image-5819" srcset="https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-1.png 897w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-1-300x39.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-1-768x99.png 768w" sizes="(max-width: 897px) 100vw, 897px" /></figure>



<p>The solution is to use an array instead. Today I found a neat solution in this <a href="https://stackoverflow.com/questions/52107054/merge-concatenate-multiple-json-files-using-powershell">StackOverflow post</a> which uses the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7#array-subexpression-operator--">Array subexpression operator</a>, rather than more long winded efforts I&#8217;ve used before:</p>



<script src="https://gist.github.com/jonathanmedd/d67181d906af2da8874c06658c961f7f.js"></script>



<p>The resulting combinedfruit.json file:</p>



<script src="https://gist.github.com/jonathanmedd/bbdbfaec362c653c8ce7a8324c867309.js"></script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>AZ-400 Azure DevOps Exam Experience</title>
		<link>https://www.jonathanmedd.net/2020/04/az-400-azure-devops-exam-experience.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Mon, 20 Apr 2020 15:42:56 +0000</pubDate>
				<category><![CDATA[azure]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5813</guid>

					<description><![CDATA[I passed the AZ-400 Azure DevOps exam last week, so thought I would share a few thoughts for anyone else considering it. I mostly used the AZ-400 course on Linux Academy by Tim Lawless to study for it and found it an excellent resource. I thought Tim did a great job of not just covering &#8230; <a href="https://www.jonathanmedd.net/2020/04/az-400-azure-devops-exam-experience.html" class="more-link">Continue reading <span class="screen-reader-text">AZ-400 Azure DevOps Exam Experience</span></a>]]></description>
										<content:encoded><![CDATA[
<p>I passed the AZ-400 Azure DevOps <a href="https://docs.microsoft.com/en-us/learn/certifications/exams/az-400">exam</a> last week, so thought I would share a few thoughts for anyone else considering it. </p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="312" height="312" src="https://www.jonathanmedd.net/wp-content/uploads/2020/04/AzureDevopsExam.jpg" alt="" class="wp-image-5814" srcset="https://www.jonathanmedd.net/wp-content/uploads/2020/04/AzureDevopsExam.jpg 312w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/AzureDevopsExam-300x300.jpg 300w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/AzureDevopsExam-150x150.jpg 150w" sizes="(max-width: 312px) 100vw, 312px" /></figure>



<p>I mostly used the <a href="https://linuxacademy.com/learning-path/microsoft-azure-az-400-azure-devops-solutions/">AZ-400 course on Linux Academy</a> by <a href="https://twitter.com/tim_lawless">Tim Lawless</a> to study for it and found it an excellent resource. I thought Tim did a great job of not just covering the topics as per the published curriculum, but also went further into illustrating many of the third-party integrations with Azure DevOps. To be fair it made a lot of sense to do this, since at a minimum at least an awareness of these integrations for common software build and deploy tools such as Jenkins, SonarQube, WhiteSource, Maven, Gradle etc is covered in many places in the exam.</p>



<p>In addition around 30 &#8211; 40% of the exam is based on Agile / DevOps theory, practice and general experience with building software in different programming languages, i.e. not technical questions around products available within the Azure DevOps suite. If that is not part of your day job or something you are unfamiliar with, then I would suggest the following books, for the Agile / DevOps part anyway:</p>



<p> &#8211; The Phoenix Project &#8211; <a href="https://itrevolution.com/book/the-phoenix-project/" target="_blank" rel="noreferrer noopener">https://itrevolution.com/book/the-phoenix-project/</a><br> &#8211; Google Site Reliability Engineering &#8211; <a href="https://landing.google.com/sre/books/" target="_blank" rel="noreferrer noopener">https://landing.google.com/sre/books/</a></p>



<p>Since all Pearson VUE test centres are currently closed and my original on-site exam booking for April was cancelled, I switched over and took it via the online exam format. I was pleasantly surprised by the experience and would definitely consider it again over a test centre. After going through some initial security checks, ID and pictures of room you are taking the test in, it was nice to not be in a room with others testing at the same time and the inevitable distractions of noise and movement. I was then monitored by a proctor via my laptop&#8217;s webcam. My online real concerns were preventing one of my currently at home family members walking into the room and invalidating the exam or perhaps troubles with home broadband. Thankfully with some preparation and good fortune I experienced no issues. Full details about taking Microsoft exams online can be found <a href="https://www.microsoft.com/en-us/learning/online-exams.aspx">here</a>.</p>



<p>The predicted lab portion for this exam was not present, so only case studies and standard multiple choice questions. I haven&#8217;t seen anything official, but a few comments on blogs suggest this has been removed temporarily from all MS exams for performance reasons due to the greater demand for online rather than on-site exams at the moment.

</p>



<p>I hope this helps you if you are headed down this certification path.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PowervRA 4.0.0 released with support for vRA Cloud and 8.0</title>
		<link>https://www.jonathanmedd.net/2020/04/powervra-4-0-0-released-with-support-for-vra-cloud-and-8-0.html</link>
		
		<dc:creator><![CDATA[Jonathan Medd]]></dc:creator>
		<pubDate>Wed, 08 Apr 2020 15:37:09 +0000</pubDate>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[PowervRA]]></category>
		<category><![CDATA[vexpert]]></category>
		<category><![CDATA[vmware]]></category>
		<guid isPermaLink="false">https://www.jonathanmedd.net/?p=5803</guid>

					<description><![CDATA[Intro Today, we have released a new version of PowervRA, 4.0.0 with support for vRA Cloud and vRA on-premises version 8.0. The observant among you will notice that we&#8217;ve incremented the PowervRA version from 3.7.0 to 4.0.0. We&#8217;ve done this since there is a significant breaking change. The API for vRA Cloud / 8.0 is &#8230; <a href="https://www.jonathanmedd.net/2020/04/powervra-4-0-0-released-with-support-for-vra-cloud-and-8-0.html" class="more-link">Continue reading <span class="screen-reader-text">PowervRA 4.0.0 released with support for vRA Cloud and 8.0</span></a>]]></description>
										<content:encoded><![CDATA[
<h2>Intro</h2>



<p>Today, we have released a new version of PowervRA, 4.0.0 with support for vRA Cloud and vRA on-premises version 8.0. The observant among you will notice that we&#8217;ve incremented the PowervRA version from 3.7.0 to 4.0.0. We&#8217;ve done this since there is a significant breaking change.</p>



<p>The API for vRA Cloud / 8.0 is completely different to that which exists for vRA 7.x and earlier. If you&#8217;ve been with the product for a while you&#8217;ll be aware of the <s>pain</s> challenge it has been to work with since inception due to the split brain nature of the product, more info <a href="https://automate-it.today/automating-vra-vcac-using-vco-part-1-split-brain/">here </a>and <a href="https://www.jonathanmedd.net/2015/05/working-with-the-vrealize-automation-rest-api-via-vrealize-orchestrator.html">here</a>. Thankfully that has gone away with the latest release, however it left us as maintainers of PowervRA to decide whether to maintain support for both sets of APIs in the same PowervRA version.</p>



<h2>Breaking Change</h2>



<p>Ultimately, we took the decision to only support the API in vRA Cloud and 8.x going forward, consequently <strong>PowervRA 4.0.0 does not support vRA 7.x and earlier.</strong></p>



<p>If you wish to continue to use PowervRA with vRA 7.x and earlier it is possible by using PowervRA 3.x, currently 3.7.0. You are able to install specific versions of PowerShell modules from the PowerShell Gallery by using the RequiredVersion parameter. So for example to install PowervRA 3.7.0:</p>



<script src="https://gist.github.com/jonathanmedd/b391309177837e0a5963acbf016ffeda.js"></script>



<p>We will continue to maintain a version of PowervRA that supports vRA 7.x, however to set a fair level of expectation please remember that this is a community based project with limited resources, both in terms of developers and lab environments and our focus going forward will be on PowervRA version 4.x and later. </p>



<p>We&#8217;ve done our best to communicate this in advance of release via Twitter and also the VMware Code Slack channel. </p>



<figure class="wp-block-embed-twitter wp-block-embed is-type-rich is-provider-twitter"><div class="wp-block-embed__wrapper">
<blockquote class="twitter-tweet" data-width="550" data-dnt="true"><p lang="en" dir="ltr">Advanced warning: we will soon be releasing PowervRA 4.0.0 which contains a significant breaking change, the new version will only be compatible with vRA 8.x and vRA Cloud. <a href="https://twitter.com/hashtag/vexpert?src=hash&amp;ref_src=twsrc%5Etfw">#vexpert</a> <a href="https://twitter.com/hashtag/PowerShell?src=hash&amp;ref_src=twsrc%5Etfw">#PowerShell</a></p>&mdash; PowervRA (@PowervRAModule) <a href="https://twitter.com/PowervRAModule/status/1244649776563597313?ref_src=twsrc%5Etfw">March 30, 2020</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div></figure>



<p>If you are aware of anyone likely to be impacted by this change, then we would be very appreciative if you would communicate it to them.</p>



<h2>Context</h2>



<p>Back when <a href="https://twitter.com/_chelnak">Craig</a> and I first developed PowervRA for release in March 2016, it was primarily formed from our own needs since we were working on vRA projects where a lot of automation was required. Since that time, and particularly in the last couple of years, the career focus for both of us has moved away from vRA and our ability to significantly develop PowervRA and deal with logged issues has diminished somewhat. At the same time interest in PowervRA has increased, over 26k downloads currently on the PowerShell Gallery!</p>



<p>Acknowledging that, <a href="https://github.com/jakkulabs/PowervRA/issues/207">we recently sought out some extra assistance</a> and that has been successful in helping us get this new version out and potentially can help support the previous version in the future. Also, by chance I happened to spend some time on a work project recently based around vRA Cloud which has meant I&#8217;ve had some hands on experience and been able to make some contributions.</p>



<p>TBH I think there is enough work for an individual to keep that person occupied full time on this project, for both PowervRA versions, for at least a number of months, but realistically that is not going to happen.  We do of course welcome Pull Requests for either version and now have more resource on-board to have a better chance to turn them round into new releases.</p>



<p>With that said, here&#8217;s a few tips on getting started with the new version! Note these are all around vRA Cloud since that is what I&#8217;ve had access to. I don&#8217;t believe there should be that much difference to the on-premises version, other than around how to make the initial connection.</p>



<h2>Getting Started</h2>



<p> Install the latest version of PowervRA: </p>



<script src="https://gist.github.com/jonathanmedd/6a0c01f7443449da4ca161930acbf95d.js"></script>



<p>Observe the available functions, currently 36:</p>



<script src="https://gist.github.com/jonathanmedd/11ec2bb40f041128048a2c2ce6454ad6.js"></script>



<h2>Getting Connected</h2>



<p>In order to authenticate with vRA Cloud an API token is required (for vRA on-premises it is different, check the help for Connect-vRAServer for details). To generate one, navigate into the management portal and your account profile. On the API token page, generate a new token with the appropriate access requirements:</p>



<figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="808" height="647" src="https://www.jonathanmedd.net/wp-content/uploads/2020/04/image.png" alt="" class="wp-image-5804" srcset="https://www.jonathanmedd.net/wp-content/uploads/2020/04/image.png 808w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-300x240.png 300w, https://www.jonathanmedd.net/wp-content/uploads/2020/04/image-768x615.png 768w" sizes="(max-width: 808px) 100vw, 808px" /></figure>



<p>Save the token somewhere safe so that is is available for use with PowervRA. </p>



<p>Using the API token, make a connection to vRA Cloud:</p>



<script src="https://gist.github.com/jonathanmedd/5bbed8b06f6cc4b31adcdabbe27345e9.js"></script>



<h2>Function Testing</h2>



<p>The <strong>Get-*</strong> functions are typically a good way to get a feel for what is available. For example to get a list of all projects in vRA Cloud:</p>



<script src="https://gist.github.com/jonathanmedd/40d3dfaad7049a57c324487c9f63fbcf.js"></script>



<h2>API Coverage</h2>



<p>You&#8217;ll notice above that in the initial 4.0.0 release there are 36 functions, so there is obviously a lot of the API not currently covered, particularly in comparison to the previous release which has over 100 functions for vRA 7.x. We hope to build up this coverage over time, in the meantime remeber that <a href="https://github.com/jakkulabs/PowervRA/blob/master/src/Functions/Public/Invoke-vRARestMethod.ps1">Invoke-vRARestMethod</a> is your friend. </p>



<p>We build all of the PowervRA functions around this helper function, so if there is a part of the API that is not covered by an existing function, you can use Invoke-vRARestMethod to fill in the gaps in the meantime.</p>



<p>For example we currently have no function coverage around Blueprints. However, by looking at the <a href="https://www.mgmt.cloud.vmware.com/automation-ui/api-docs/">vRA API documentation</a> there are examples for working with Blueprints. So the following code using Invoke-vRARestMethod would get you details about Blueprints:</p>



<script src="https://gist.github.com/jonathanmedd/88c50b6cfa903e2f43286e3f4bbdc9bc.js"></script>



<h2>Finally</h2>



<p>Thanks for your interest in PowervRA. We hope you find the new version useful and we look forward to taking it further. Providing feedback via <a href="https://github.com/jakkulabs/PowervRA/issues">issues</a> and code contributions via <a href="https://github.com/jakkulabs/PowervRA/pulls">pull requests</a> would be a great way to help us do that.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
