how connect to Azure Machine Learning Web service using PowerShell? - powershell

To use Azure Machine Learning Web service here you can find some sample code in C#, R, Python and JavaScript. I want to use it in PowerShell.
I found this tutorial, but when I am running bellow line of code, it will return error that it is not recognized:
Set-AzureMLWebServiceConnection -URI $Url -APIKey $API_key
Output:
Set-AzureMLWebServiceConnection : The term 'Set-AzureMLWebServiceConnection' 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 C:\Users\Reza\Desktop\ndbench\Azure\Automation\01_get_metrics\add_target_to_tables - runbook_01.ps1:33 char:1
+ Set-AzureMLWebServiceConnection -URI $Url -APIKey $API_key
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureMLWebServiceConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I can't found Set-AzureMLWebServiceConnection in my PowerShell command-list and I don't know how I can enable/install it.
Can you please guide me, how I can connect to Azure Machine Learning Web service using PowerShell?

The comment #gvee mentioned may be the best to use going forward though it is in beta.
However, to answer your question, use the Install-Module -Name AzureML command to get access to the Azure ML commands.

Related

how to create high trust SharePoint Add-ins?

I am working on SharePoint add-in to create high trusted app. I am trying to create SharePoint add-in using certificates. I took Create high-trust SharePoint Add-ins as the reference. I have successfully generated .pfx and .cer file. Now, the next step is to configure SharePoint. I have opened my SharePoint Online Management Shell in Administrator mode. I executed these 2 lines successfully.
$publicCertPath = "C:\Certs\HighTrustSampleCert.cer"
$certificate = New-Object
System.Security.Cryptography.X509Certificates.X509Certificate2($publicCertPath)
As soon as i entered New-SPTrustedRootAuthority -Name "HighTrustSampleCert" -Certificate $certificate, I got the following exception.
New-SPTrustedRootAuthority : The term 'New-SPTrustedRootAuthority' 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:1 char:1
+ New-SPTrustedRootAuthority -Name "HighTrustSampleCert" -Certificate $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-SPTrustedRootAuthority:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I don't know, why am I getting this error. Is there any other way to generate high trusted SharePoint add-in?
High-trust add-in cannot be installed to Microsoft SharePoint Online, you need use low-trust for SharePoint online.

Cannot Uninstall IoT Edge on Windows Server

I need to swap an IoT Edge device on Windows from one IoT Hub to another. I understand that current logic forces me to Uninstall IoT-Edge and install it again.
The problem is I get the following error trying to run this script:
{Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Uninstall-IoTEdge
I get this in return:
Invoke-Native : The term 'cmd' 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:1748 char:28
+ ... ersString = Invoke-Native "$dockerExe ps --all --format ""{{.ID}}""" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (cmd:String) [Invoke-Native], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Invoke-Native
The Powershell is elevated as Admin. Am my missing some PATH variables? Any Ideas?
would you please run below commands in PowerShell window and share the results?
Get-Command "docker.exe"
Write-Host $env:ProgramFiles\iotedge-moby
check if the path exists or not.
do you know which version of iotedge service you installed? if the service is running, you can run "iotedge version" to find it out.
Thanks for the suggestion, but did manage to find workaround by removing docker with the help of this script:
https://success.docker.com/article/how-to-completely-remove-docker-in-windows-10
As fas as IOT Edge version it is 1.0.7 as 1.0.8. does not work in transparent gateway mode with Node-Red MQTT node (MS advised to wait for 1.0.9 where this bug will be fixed).

Azure App Service Scaling powershell

I have app service in my environment named "Standard" . Currently the app service is configured in standard tier small 1 instance.
Using powershell I am trying to scale the app service which will in turn scale the web apps inside this app service.
I want to change size to Medium and instances to 2.
Here is my snippet.
Login-AzureRmAccount
Set-AzureRMAppServicePlan -Name Standard -ResourceGroupName
MyWebAppRG - NumberofWorkers 2 -WorkerSize Medium
When I run this command I am getting following error
Set-AzureRMAppServicePlan : Could not load file or assembly 'Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=0.11.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:11 char:1
+ Set-AzureRMAppServicePlan -Name Standard -ResourceGroupName MyWebAppRG -Numbero ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-AzureRMAppServicePlan], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Azure.Commands.WebApps.Cmdlets.AppServicePlans.SetAzureAppSe
rvicePlanCmdlet
I am not sure, what's wrong here? and what exactly this error means.
For the information, I am able to run other powershell commands just fine,example set-AzureRMResource and others. so isn't an environment issue.
Any help appreciated..
Thanks
What version of the Azure Powershell are you using? This was a known issue in Azure Powershell 1.0.0. If you are using that version, use the version below instead. Do post back if you still see issues.
https://github.com/Azure/azure-powershell/releases/tag/v1.0.1-November2015

Exception creating client using AWS SDK

I am currently using the following sequence of commands in a Windows 7 PowerShell window.
Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll"
$secretKeyID="ABCDEFGHIJKLMNOPQRS"
$secretAccessKeyID="LONGKEYBLAHBLAHBLAHBLAHBLABLAH"
$AWSclient=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID,$secretAccessKeyID)
However, I get this exception below. Please let me know what Im doing wrong. This is what I see most people using successfully.
Exception calling "CreateAmazonS3Client" with "2" argument(s): "No RegionEndpoint or ServiceURL configured"
At line:1 char:1
+ $oAWSclient=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID,$secret ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : AmazonClientException
One thing that I think is a problem is that my bucket is not checked for 'enable website hosting'. Does this need to be set to true? I just want to upload a file to the bucked via powershell script.
Duh... I realized that I need to use the AWS Powershell because it has all the settings built into it. Im not exactly sure how to properly refer to this version of powershell, but it is available after installing the AWS SDK.
Since the error specifically states that you're missing the RegionEndpoint or ServiceURL, you could also just include one of them. Since you're connecting to S3, all you need is to include the RegionEndpoint.
Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll"
$secretKeyID="ABCDEFGHIJKLMNOPQRS"
$secretAccessKeyID="LONGKEYBLAHBLAHBLAHBLAHBLABLAH"
$client = [Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID, $secretAccessKeyID, [Amazon.RegionEndpoint]::USEast1)
(Replace USEast1 with the value configured with your S3 Bucket)

Windows Azure Powershell command Get-AzureWebsite results in error String was not recognized as a valid Boolean

I'm trying to manage some of my Azure Services via Powershell, using http://windowsazurewebsitescheatsheet.info/#powershell as a starting point. I was able to download and import my subscription settings just fine (Import-AzurePublishSettingsFile and Select-AzureSubscription)
After choosing my subscription, I'm attempting to run the Get-AzureWebsite command to view all of my websites, and continue onward from there. When I run that command, however, I get the following:
Import-AzurePublishSettingsFile "C:\AzureCredentials.publishsettings"
Select-AzureSubscription "My Azure Subscription"
Get-AzureWebsite
Get-AzureWebsite : String was not recognized as a valid Boolean.
At line:1 char:1
+ Get-AzureWebsite
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureWebsite], FormatException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand
Anyone have similar issues? I get this error if I run the command as stated above, or if I specify the name of my website. TIA for any help!
This might be related to a known issue enumerating a sites with SSL bindings
There was new release of Windows Azure Powershell released on 02/12. Please try with the new version.
Please run the command again with -Debug turned on, this will display request and response messages and make it easier to pinpoint the issue.