3

I am trying to upload a custom DSC module to our Azure Automation account.

C:\Code\Epitec DSC [master ≡ +1 ~1 -1 !]> Set-AzureRmAutomationModule -Name "WindowsUpdate" -ContentLinkUri "{ContentURL}.zip" -ResourceGroupName "OI-Default-East-US" -AutomationAccountName "Epitec-Automation" -Verbose
Set-AzureRmAutomationModule : The Automation account was not found.
At line:1 char:1
+ Set-AzureRmAutomationModule -Name "WindowsUpdate" -ContentLinkUri "ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Set-AzureRmAutomationModule], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.SetAzureAutomationModule

Running the command Get-AzureRmAutomationAccount I am able to get the automation account

C:\Code\Epitec DSC [master ≡ +1 ~1 -1 !]> Get-AzureRmAutomationAccount -ResourceGroupName "OI-Default-East-US" -Name "Epitec-Automation"


SubscriptionId        : 
ResourceGroupName     : OI-Default-East-US
AutomationAccountName : Epitec-Automation
Location              : East US 2
State                 : Ok
Plan                  : Free
CreationTime          : 12/29/2015 4:10:03 PM -05:00
LastModifiedTime      : 10/12/2016 9:26:53 AM -04:00
LastModifiedBy        : lsmith@epitec.com
Tags                  : {}

I've also tried piping it through like so

C:\Code\Epitec DSC [master ≡ +1 ~1 -1 !]> Get-AzureRmAutomationAccount -ResourceGroupName "OI-Default-East-US" -Name "Epitec-Automation" | Set-AzureRmAutomationModule -ContentLinkUri "{ContentURL}.zip" -Name "WindowsUpdate"
Set-AzureRmAutomationModule : The Automation account was not found.
At line:1 char:98
+ ... tomation" | Set-AzureRmAutomationModule -ContentLinkUri "https://epit ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Set-AzureRmAutomationModule], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.SetAzureAutomationModule

I have no issues uploading the zip file through the Azure portal site, however, I am trying to automate the process using PowerShell.

Lloyd Smith
  • 231
  • 3
  • 9
  • can you try passing the automation account name and the resource group name via variable rather than string? Shot in the dark – CtrlDot Oct 20 '16 at 03:40
  • @CtrlDot Still get the same error message when using variables instead of strings for the names – Lloyd Smith Oct 20 '16 at 12:29
  • Did you ever solve this? I'm having the same problem with New-AzureRmAutomationConnection. Get-AzureRmAutomationAccount works fine. – Larry Silverman Dec 28 '16 at 21:25
  • @LarrySilverman I did not. I've also moved on to a new position where I'm not working with Azure now. So I don't know when I'll get around to trying to solve this. – Lloyd Smith Jan 09 '17 at 19:45

2 Answers2

0

I cannot get to reply to the comments, but larry, is there a chance you are using subscriptionname instead of subscriptionid for connectionfields of the connection you are trying to create?

Try running the command with -debug, it should lead you to more insight. i just found my issue and it was that

Pixel
  • 146
  • 5
0

The Error is misleading.... Yea took me a while aswell.
Its the value for ConnectionFieldValues that needs to be changed.
I used the folling and it worked.

-ConnectionFieldValues @{
   CertificateThumbprint = $X
   SubscriptionID = $XX
   TenantId = $XXX
   ApplicationId = $XXXX
}
alexander.polomodov
  • 1,068
  • 3
  • 10
  • 14
Julien
  • 1