Automating a Data Factory pipeline using a runbook seemed like an easy last step in a Azure DWH setup I developed lately. To automate the DWH load, I started to create a PowerShell script runbook in my Azure Automation Account. The goal of this runbook was to start the Azure DWH component, run the pipelines in Azure Data Factory, each containing a different step in the process enabling me to load the available source data, transform it into DWH structures and copy the resulting Datamart into an Azure DB, and finally, once it completed, stop the DWH component again.
The part in my script responsible to start and stop the DWH ran without problems, but then I wanted to call the Data Factory V2 pipeline to execute it.
This part immediately threw the following error.
The ‘Check the spelling of the name’ part of the error was my first clue, but after investigating, this was not the case unfortunately. After some further investigation it seemed that the Automation Account did not include the AzureRM.DataFactoryV2 module inside my automation runtime.
To get an overview of the available PowerShell modules inside the runtime, you can run the following command:
Get-Module -ListAvailable Azure* | Select-Object Name, Version, Path
This confirmed that indeed the mentioned DataFactoryV2 module did not exist in this account, as it contained only the default modules.
If you want to use other modules, you need to import them into the runtime environment.
There are several ways to accomplish this
The easiest way to accomplish this is by importing the module using a fully qualified path:
Import-Module "$env:ProgramFiles(x86)\Microsoft SDKs\Azure\PowerShell\AzureRM.psd1"
(Source: https://docs.microsoft.com/en-us/powershell/azure/other-install?view=azurermps-6.0.0)
But sometimes this does not work, because there are some conditions that have to be fulfilled.
Some common reasons that a module might not successfully import to Azure Automation are:
I was not able to get this work, probably related to the fact I had no prior experience in PowerShell.
Fortunately, I found another method to import a new PowerShell Module.
Open your Automation Account in the Azure portal, scroll down to ‘Shared resources’ and choose ‘Modules’. The list of available modules in this account are shown.
When you want to start loading new modules, run the ‘Update Azure Module’ so you have the latest version of the standard modules.
Next step is to import the modules you need.
There are 2 different ways to do this:
Unfortunately, it was not working in my case. It was throwing error because he expected an AzureRM.profile version > 5.0.0 (even though I updated the Azure modules before, he still had a 4.6.0 version).
In the gallery I searched for AzureRM.profile. I found a version > 5.0.0 and imported this one. I received a succeeded message but he still gave a 4.6.0 version in the modules tab.
So, both the ‘Update Azure Module’ and ‘Browse gallery’ were not able to load the required AzureRM.profile version required to load the AzureRm.DataFactoryV2 Module.
This is probably the same reason why my first attempts failed.
The other option provided is to add a PowerShell module from your local machine.
Make sure that you updated your local PowerShell modules (https://docs.microsoft.com/en-us/powershell/azure/other-install?view=azurermps-6.0.0) prior to uploading them and then import the module as a zip file using the ‘add a module’ option.
Note: Even though a Microsoft blog (https://azure.microsoft.com/nl-nl/blog/announcing-azure-resource-manager-support-azure-automation-runbooks/) stated the below, I only had to import the module I need to make it work.
Please note the new guidance is that if the latest version of any Azure/AzureRM module is imported as a user module to an automation account, the latest versions of ALL Azure/AzureRM modules (not just the ones that ship out of the box in Azure Automation) should be imported to the automation account, to avoid any version mismatch issues that could occur now or in the future if Azure Automation later ships any additional (or newer version) Azure/AzureRM modules as global modules.
After the import from my local machine using the UI on the Azure Portal he imported the required module, and my runbook worked like a charm.
Cookie | Duration | Description |
---|---|---|
ARRAffinity | session | ARRAffinity cookie is set by Azure app service, and allows the service to choose the right instance established by a user to deliver subsequent requests made by that user. |
ARRAffinitySameSite | session | This cookie is set by Windows Azure cloud, and is used for load balancing to make sure the visitor page requests are routed to the same server in any browsing session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | Cloudflare set the cookie to support Cloudflare Bot Management. |
pll_language | 1 year | Polylang sets this cookie to remember the language the user selects when returning to the website and get the language information when unavailable in another way. |
Cookie | Duration | Description |
---|---|---|
_ga | 1 year 1 month 4 days | Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors. |
_ga_* | 1 year 1 month 4 days | Google Analytics sets this cookie to store and count page views. |
_gat_gtag_UA_* | 1 minute | Google Analytics sets this cookie to store a unique user ID. |
_gid | 1 day | Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously. |
ai_session | 30 minutes | This is a unique anonymous session identifier cookie set by Microsoft Application Insights software to gather statistical usage and telemetry data for apps built on the Azure cloud platform. |
CONSENT | 2 years | YouTube sets this cookie via embedded YouTube videos and registers anonymous statistical data. |
vuid | 1 year 1 month 4 days | Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. |
Cookie | Duration | Description |
---|---|---|
ai_user | 1 year | Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time. |
VISITOR_INFO1_LIVE | 5 months 27 days | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt.innertube::nextId | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
WFESessionId | session | No description available. |