Powershell Webjob fails to run - powershell

I have created a Powershell Webjob for use in the Azure Logic App. The code is trying to generate a signed URI so the end user can download the file when its available. To do that I created a simple Powershell Webjob.
New-AzureStorageContext : The term 'New-AzureStorageContext' 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.
CommandNotFoundException New-AzureStorageBlobSASToken : The term 'New-AzureStorageBlobSASToken' 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.
I know these are part of the Azure Powershell. But is there an alternative for them to run? Or would I need to resolve to a separate console application?

After a lot of google searching, I found that Azure Powershell jobs do not support Azure commands. They have a plan to allow for that, but currently you cannot run Azure PowerShell Jobs on WebApps Webjob.

Related

TerraformApply.jsonOutputVariablesPath : The term 'TerraformApply.jsonOutputVariablesPath' is not recognized as the name of a cmdlet, function

TerraformApply.jsonOutputVariablesPath : The term
'TerraformApply.jsonOutputVariablesPath' 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.
I'm trying to output varaibles via terraform In azure devops but everytime i run pipeline
this happens . P.S i'm using self hosted agent
It's a problem with the version on the task.
I assume you are using V1.
Try using V3 for the apply.
I've opened an issue at
https://github.com/microsoft/azure-pipelines-terraform/issues/83
Edit: I messed up the versions .

Why is System.AccessToken is not recognized as the name of a cmdlet in a Release in Azure DevOps?

I am building a task in my Release in Azure DevOps. In this task, I have a Powershell script I am running that needs to call some of Azure's Web APIs and so forth so I have a parameter to pass in the AccessToken. But I am getting the following error:
System.AccessToken : The term 'System.AccessToken' 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.
Here is what my parameter that I am passing in looks like.
-AccessToken "$(System.AccessToken)"
Why is this happening? Is there a work around?
You need to enable access to OAuth token in your agent job
See this https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=classic#access-to-oauth-token

Can't submit Data Analytics job in PowerShell Portal

Why can't I run the Submit-AzureRmDataLakeAnalyticsJob cmdlet in a PowerShell runbook via the Aure web portal? I get the following error message:
Submit-AzureRmDataLakeAnalyticsJob : The term 'Submit-AzureRmDataLakeAnalyticsJob' 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.
I'm able to run this command with no errors in the PowerShell ISE.
Can this type of command not be run in a runbook or something? Maybe I'm just not understanding PowerShell
I seem to have solved the issue. I had to import some AzureRM.* modules via the Module Gallery on the portal.

Azure Powershell agent task pipeline

I'm just wondering whats the chain underlies Azure Powershell VSO agent task. I assume that is not simple powershell host because it is not working with some commandlets (for example Get-Module -ListAvailable) and fails with an error:
The term 'Get-ServiceEndpoint' 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.
A Connected Service with name 'xxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxx' could not be found. Ensure that
this Connected Service was successfully provisioned using services tab
in Admin UI.
VSTS build task are normal powershell scripts. However the 'Get-ServiceEndpoint' is a known issue: issue.
As far as I can see other cmdlets are working normally. I've been able to write several build tasks without any problems.

Manage Azure Redis Cache with Azure PowerShell

When I try to run below command to just start with Azure Redis cache I am getting below error message. Am I missing something? I am using Windows PowerShell, Version 3.0.
PS C:> New-AzureRedisCache
New-AzureRedisCache : The term 'New-AzureRedisCache' 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.
You don't have all the prerequisites complete (no Azure PowerShell commands loaded). Follow the instructions at Manage Azure Redis Cache with Azure PowerShell.