Quantcast
Viewing all articles
Browse latest Browse all 20616

Powershell script to monitor azure

Hello,

 

I'm trying to monitor some windows azure components using powershell,

The script is running locally on the SAM server. If I execute it in powershell shell it works.

 

Here is the script :

Import-AzurePublishSettingsFile "C:\Scripts\Folder\SolarWinds.publishsettings"  | Out-Null


$subscriptionName = "blabla"

$CloudServiceName = "blabla"

$RoleName = "blabla"

$numberOfMinute = 3

$InstanceName = "blabla"

$Slot = "blabla"

 

Select-AzureSubscription -SubscriptionName $subscriptionName  | Out-Null

 

Get-AzureRole -ServiceName $CloudServiceName -Slot $Slot -RoleName $RoleName -InstanceDetails | Where-Object {$_.InstanceName -eq $InstanceName} | Format-Table –Auto  InstanceName, InstanceStatus

 

The problem is when invoking this script in solarwinds i'm getting the following error :

 

Errors: ==============================================

Import-AzurePublishSettingsFile : The term 'Import-AzurePublishSettingsFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:2 char:1

+ Import-AzurePublishSettingsFile "C:\Scripts\Fodler\Sola ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (Import-AzurePublishSettingsFile:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

Since it cannot import the publish settings it cannot run.

 

The publish setting file is located on the SAM server.

 

Any ideas ?


Viewing all articles
Browse latest Browse all 20616

Trending Articles