eShopOnContainers-Deploy to Azure Kubernetes Service - azure

I am trying to deploy eShopOncontainers to AKS with the help of eShopOncontainers-wiki-github.
I don't know where/how to run the below command. They mentioned "Deploy Public Images From DockerHub" for windows use below command.
.\deploy-all.ps1 -externalDns aks -aksName -aksRg -imageTag linux-dev -useMesh $false
I've tried both Azure cli and windows powershell, the below error is showing
The term '.\deploy-all.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program.

Related

Azure CLI - Automation account replace-content is breaking on new line

I've got a very frustrating situation using the Azure CLI and attempting to replace the content of an Automation Account.
I am attempting to update it via a Azure DevOps pipeline AzureCLI#2 task. This is the script line i am calling
az automation runbook replace-content --debug --automation-account-name "${{ parameters.automationAccountName }}" --resource-group "${{ parameters.resourceGroup }}" --name "Schedule Summary" --content "`#temp.txt"
The issue i am having is the automation account runbook is updated, but the text is truncated. The contents of temp.txt is this -
Param(
[string]$resourceGroup ='',
[string]$UAMI ='',
[string]$serverInstance ='',
But the script that ends up in the runbook is simply
Param(
Its clearly breaking on CRLF but i can't figure out how to fix it. If i remove all CRLF then it appears as one line and the script then doesn't run.
I can tell where the problem is? Is the AzureCLI, powershell? or the devops task.
I've tried in my environment by adding Devops CLI extension in Azure bash and it worked for me successfully with the same parameters as yours.
I created a PS file in Az cloud itself and saved with the .ps1 extension as set the runbook type to PowerShell and updated the script as follows:
az automation runbook replace-content --content "#runbook.ps1" --automation-account-name "xxxxautomation" --name "xxxxrunbook" --resource-group "xxxxRG"
vi runbook.ps1:
Content replacement done in runbook:
If still the issue persists: In Azure DevOps, call a webhook with parameters and then start a runbook that imports the Azure DevOps runbooks.
But when you are dealing with Azure DevOps, I suggest you create or update runbooks via API instead of PowerShell modules which is efficient.
I run the script in windows hosted agent and reproduce your issue.Its clearly breaking on CRLF. Because windows can't identify the CRLF. You should run the script in Linux agent.
breaking on CRLF based on windows agent
alter to linux agent in pipeline
pool:
vmImage: ubuntu-22.04

Is it possible to use "run command" within a node js Azure Function?

I have a Powershell Script on a Windows VM and can it run from outside of the VM via "run command" function.
Is it possible to use this also from a NodeJS Azure Function?
Do i have to configure dependencies and just do not find where I can configure?
For example I want to run this command from the NodeJS Azure Function:
az vm run-command invoke --command-id RunPowerShellScript --name win-vm -g my-resource-group \
--scripts #script.ps1 --parameters "arg1=somefoo" "arg2=somebar"
There is an option while creating the function apps. We need to choose either PowerShell or any kind of programming language NodeJS & Powershell. For an instance check with PowerShell as required. And create a function app.
The second option here is to execute a query in the node JS where we can run the command. To execute the command and test, check the screens below.
Thanks #msp4msps for the clear steps
Refer Running PowerShell in Azure function for more details

Azure staticwebapp not allowing to add config with "&" in value using Azure CLI in terminal

I am using Azure CLI to use the azure. I am trying to create a staticwebapp and later try to add the configuration from CLI.
I tried to run this
az staticwebapp appsettings set -n appname --setting-names MONGO_CONNECTION_STRING="mongodb+srv://anirudha:testing#cluster4340.v45343.mongodb.net/?retryWrites=true&w=majority"
I am getting error
'w' is not recognized as an internal or external command,
operable program or batch file.
I go to portal and seen before &w=majority is added into configuration but this part is not added after &.
I tried to put singlequote and key=("val") but none of them working for me. I found this in azure app config github repo.
Anyone have idea how to make it work from CLI
--setting-names property accepts the app settings in 'key=value' format as mentioned here in this documentation of az staticwebapp app settings set cmdlet.
You need to change the above shared cmdlet to the below:
az staticwebapp appsettings set -n <staticWebAppName> --setting-names 'MONGO_CONNECTION_STRING=<AppsettingValue>'
I have tested this and it is working fine from my end Here is the sample output screenshot for your reference:
Updated Answer:
Alternatively, you can use this PowerShell cmdlet
(New-AzStaticWebAppSetting) to update the app settings of the static web app
New-AzStaticWebAppSetting -ResourceGroupName resourceGroup -Name staticweb01 -AppSetting #{'function01' = 'value01'; 'function02' = 'value02' }

I get this error in windows CMD "stat: path too long for Windows" -- Azure cli

I get this error in windows CMD "stat: path too long for Windows" whenever I execute this command below in my azure cli in windows CMD.
az group deployment create -g "testacsengine" --template-file azuredeploy.json --parameters #azuredeploy.parameters.json
In windows, if you already install the Azure CLI model, you can execute the CLI command in CMD or Windows PowerShell ISE.
For the deployment of Azure template, you can just use the command az group deployment create -g "charlesTest" --template-file template.json in the directory of your template.
Or use the absolute path like this az group deployment create -g "charlesTest" --template-file D:\template.json. Of curse, you need to get authentication with the command az login first.
If you still get the error when you do this, the error must be inside your template. You should check your template correctly.
For more details about template deployment, see az group deployment create.

Azure CLI task "az sf cluster create" fails with hosted agent

The following command is based on a code snippet I found in the official documentation to create a Linux Service Fabric cluster.
Originally it was bash script, but that's not available on my private build agents (requires windows insider program??) so I switched to batch script.
I wonder why the following command fails:
d:\a\r1\a>call az sf cluster create --resource-group "ha17aztestclustergroup" --location "westeurope" --certificate-output-folder . --certificate-password "433q6D7sdNKkd-.,6ck#6" --certificate-subject-name "ha17rsomaztestsf.cloudapp.azure.com" --cluster-name "ha17aztestcluster" --cluster-size 3 --os UbuntuServer1604 --vault-name "ha17rsomaztestkeyvault" --vault-resource-group "ha17aztestclustergroup" --vm-password $VmPassword --vm-user-name "sfadmin"
ERROR: az sf cluster: error: argument subcommand: invalid choice: create
usage: az sf cluster [-h]
{select,manifest,code-version,config-version,health} ...
The exact same inline script does work on my private build agents with AZ CLI 2.0.20 installed.
Azure hosted Agents (VS2017) has AZ CLI 2.0.14 installed.
But I doubt that's the problem.
The Hosted VS2017 has Azure CLI 2.0.14 installed, there isn’t create command for az sf cluster (2.0.21 contains), you can check it by adding Azure CLI task with az sf cluster --help command to check its commands.
So, you can setup a private build agent and do build with this agent. Deploy an agent on Windows
I ran into a similar problem whilst deploying a different resource (Function Apps). There was a bug fix in a later version than what was installed on the hosted agents.
I ended up getting around this problem by either dynamically injecting this command into my scripts or by simply having an extra Azure CLI step in my Release to update Azure CLI
pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
Unfortunately it takes nearly 5 minutes to update the Agent but all of my Releases are reliable now.

Resources