Azure CLI az vm commands no longer creates an output on success - azure

We are using an Azure CLI command to start/stop/deallocate VMs.
az vm start -g trg -n AzureCoE-VS1
This command used to give an output like
{
"endTime": "2018-08-03T10:20:56.271327+00:00",
"error": null,
"name": "1bc3b4ec-16b1-4f1f-a6a7-78fc23e62677",
"startTime": "2018-08-03T10:20:46.849438+00:00",
"status": "Succeeded"
}
However, we are no longer able to see this output as a result of which our application is breaking.
this used to work earlier.

Related

Invoke an Azure CLI command that I've created using az vmss run-command create

I've created a command using the Azure CLI like this, that I want to use to pull docker logs from a container running in an Azure Virtual Machine ScaleSet (VMSS):
az vmss run-command create --resource-group "my-resource-group" --instance-id "0" --location "[azure_location_here]" --async-execution false --run-as-user "su" --script "docker logs ab5" --timeout-in-seconds 3600 --run-command-name "myCommandName" --vmss-name "aks-myservice-1234567-vmss" --output-blob-uri "https://myfileshare.blob.core.windows.net/my-azure-storage-container/log.txt"
I can see the command listed when I use:
az vmss run-command list --subscription "[my_subscription_id]" -g my-resource-group --vmss-name "aks-myservice-1234567-vmss" --instance-id 0
This gives me the following:
[
{
"asyncExecution": false,
"errorBlobUri": null,
"id": "/subscriptions/[my_subscription_id]/resourceGroups/my_resource_group/providers/Microsoft.Compute/virtualMachineScaleSets/aks-myservice-1234567-vmss/virtualMachines/0/runCommands/myCommandName",
"instanceView": null,
"location": "[azure_location_here]",
"name": "myCommandName",
"outputBlobUri": "https://myfileshare.blob.core.windows.net/my-azure-storage-container/log.txt",
"parameters": null,
"protectedParameters": null,
"provisioningState": "Succeeded",
"resourceGroup": "my_resource_group",
"runAsPassword": null,
"runAsUser": "su",
"source": {
"commandId": null,
"script": "docker logs ab5",
"scriptUri": null
},
"tags": null,
"timeoutInSeconds": 3600,
"type": "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"
}
]
I'm trying to invoke the command using the following:
az vmss run-command invoke -g my-resource-group -n aks-myservice-1234567-vmss --instance-id 0 --command-id myCommandName
This gives me the error:
(NotFound) The entity was not found in this Azure location.
How can I invoke (run) the command that I created in the first step, so that the script docker logs ab5 is run on the VMSS instance? I know how to directly run this script using az vmss run-command invoke, but the output is limited to the first 4096 bytes of the docker log. I'm trying to use az vmss run-command create to set up the script, as that allows me to use the parameter --output-blob-uri, which I'm hoping will allow me to capture the entire Docker log in a file within Azure storage once I invoke the script.
The documentation for az vmss run-command invoke isn't really clear on how a command can be invoked that was created using az vmss run-command create.

Azure API call - az apim update - update customProperties

I am using following az api call command az apim show -n Namexxx -g RGxxx. As an output I am getting below:
{
"additionalLocations": null,
"apiVersionConstraint": {
"minApiVersion": null
},
"certificates": null,
"createdAtUtc": "2021-10-15T08:49:38.486813+00:00",
"customProperties": {
"Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": "true",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": "false"
},
I need to modify one of the customProperties. I tried to use command: az apim update -n xxNamexx -g xxRGxx --set customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168=false but I am getting an error like below:
Couldn't find 'Microsoft' in 'customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security'. Available options: ['Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2'
In MS API dos didn't find any useful information --> AZ apim API
#tester81
Command group 'apim' is experimental and under development.I tested the functionality at my end and I was encountering the same issue in a WinPowershell.
I did find an different behavior at the Ubuntu Terminal.
If you are not making use of Win Powershell/cmd for invoking the az commandlet, you could probably try the below script at your end in your linux terminal.
customPropertiesUpdated=$(az apim show -n <APIM NAME> -g <APIM RESOURCE GROUP> --query customProperties | jq '."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" = "True"')
az apim update -n <APIM NAME> -g <APIM RESOURCE GROUP> --set customProperties="$customPropertiesUpdated"
The above script helped in changing the state. However, a relative script in Win Powershell / Commad prompt / Cloud shell did not.
The Alternative or the recommended approach would be to make use of the REST API - until it is out of the experimental stage.
Please do see properties.customProperties - Api Management Service - Create Or Update - REST API (Azure API Management) | Microsoft Docs

Azure app service - web deployment using FTP

For web deployment using FTP;I came across a situation, where i'm using Azure CLI command to create an app service plan in FREE tier to deploy the web app in it.
Here is how i am approaching:
used command:
az login --allow-no-subscriptions
sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code xxxxxxx to authenticate. Working fine with below result.
[
{
"cloudName": "AzureCloud",
"id": "1fdacf7a-xxxxx-xxxx-xxxx-xxxxxxxxxxxxx",
"isDefault": true,
"name": "N/A(tenant level account)",
"state": "Enabled",
"tenantId": "1fdacf7a-xxxxx-xxxx-xxxx-xxxxxxxxxxxxx",
"user": {
"name": "email#gmail.com",
"type": "user"
}
}
]
Then, create basic app service plan using :
"az appservice plan create -g MyResourceGroup -n MyPlan"
This gives me error saying "The subscription 1fdacf7a-xxxxx-xxxx-xxxx-
xxxxxxxxxxxxx could not be found.
How to resolve this problem? Thanks.
I can reproduce your issue, to fix the issue, please don't use the --allow-no-subscriptions parameter.
You just need to login with:
az login
or
az login --use-device-code
Then use the command below to set the subscription:
az account set --subscription 1fdacf7a-xxxxx-xxxx-xxxx-xxxxxxxxxxxxx
Run az appservice plan create -g MyResourceGroup -n MyPlan:

Service Fabric Mesh unable to start sample application after deployment

I am trying to get a sample Service Fabric Mesh application deployed to Azure. The deployment shows as being successful, but I am unable to access the application once it is deployed. The only evidence I can find that there is an issue is the "UnhealthyEvaluation" property returned when querying the app via PowerShell CLI.
Here is what that shows.
PS C:\WINDOWS\system32> az mesh app show --resource-group Proto --name todolistapp-CsProto
{
"debugParams": null,
"description": "todolistapp description.",
"diagnostics": null,
"healthState": "Warning",
"id": "/subscriptions/2224ba65-ee14-4fa5-b62c-f586d05b6bb5/resourcegroups/Proto/providers/Microsoft.ServiceFabricMesh/applications/todolistapp-CsProto",
"location": "eastus",
"name": "todolistapp-CsProto",
"provisioningState": "Succeeded",
"resourceGroup": "Proto",
"serviceNames": [
"WebFrontEnd",
"Service1"
],
"services": null,
"status": "Ready",
"statusDetails": null,
"tags": {},
"type": "Microsoft.ServiceFabricMesh/applications",
"unhealthyEvaluation": "Unhealthy deployed applications: 100% (1/1), MaxPercentUnhealthyDeployedApplications=0%.\r\n Unhealthy deployed application: ApplicationName='fabric:/todolistapp-CsProto', NodeName='_Dev_1', AggregatedHealthState='Warning'.\r\n Unhealthy deployed service packages: 50% (
1/2).\r\n Unhealthy deployed service package: ApplicationName='fabric:/todolistapp-CsProto', ServiceManifestName='Service1Pkg', ServicePackageActivationId='5a5b1584-ea7d-46bf-9ce2-ad56b2c843ff', NodeName='_Dev_1', AggregatedHealthState='Warning'.\r\n Unhealthy event: SourceId='System.Hos
ting', Property='CodePackageActivation:Service1:EntryPoint', HealthState='Warning', ConsiderWarningAsError=false. 'There was an error during CodePackage activation.System.Fabric.FabricException (-2147017731)\r\nFailed to start Container. ContainerName=sf-155-f0b08730-815a-421c-a312-0334c3f9b11c_5a5b
1584-ea7d-46bf-9ce2-ad56b2c843ff, ApplicationId=SingleInstance_148_App155, ApplicationName=fabric:/todolistapp-CsProto. DockerRequest returned StatusCode=InternalServerError with ResponseBody={\"message\":\"failed to create endpoint sf-155-f0b08730-815a-421c-a312-0334c3f9b11c_5a5b1584-ea7d-46bf-9ce2
-ad56b2c843ff on network nat: HNS failed with error : You were not connected beca'\r\n"
}
I'm happy to provide any additional information that might be helpful in figuring this out. Part of the problem is that the Azure Portal UI for the Service Fabric Mesh application and services does not show any logging. I believe that is because the logs have not yet been implemented there. Additionally, querying the container logs via PowerShell CLI isn't returning anything either.
PowerShell Container Log
PS C:\WINDOWS\system32> az mesh code-package-log get --resource-group Proto --app-name todolistapp-CsProto --service-name WebFrontEnd --replica-name 0 --code-package-name WebFrontEnd
{'additional_properties': {}, 'content': ''}
and
PS C:\WINDOWS\system32> az mesh code-package-log get --resource-group Proto --app-name todolistapp-CsProto --service-name Service1 --replica-name 0 --code-package-name Service1
{'additional_properties': {}, 'content': ''}
Any insight on this would be greatly appreciated!

Is it possible to use Azure CLI to configure deployment to an app service from a Dropbox location?

So I'm following this guide in order tosuse Azure 2.0 CLI to create an app service to deploy.
https://learn.microsoft.com/en-us/azure/app-service-web/app-service-web-get-started
I have set up the resource group, the app service plan and the app but instead of setting up the deployment with a Git repository like this
az appservice web source-control config-local-git --name <app_name> --resource-group my-first-app-group
I would like to put all my files into a folder in DropBox.
This step can be done by using the Azure web site but I would like to know if it is possible to using the Azure 2.0 CLI? If so, what is the command?
I would like to put all my files into a folder in DropBox.
This step can be done by using the Azure web site but I would like to
know if it is possible to using the Azure 2.0 CLI?
We can use CLI 2.0 command like this:
C:\Users>az appservice web source-control config --repo-url https://www.dropbox.com/sh/ar7n31ozqgchnb2/AABxdZN4v4pklk3USCnFBWdVa?dl=0 --repository-type mercurial --name jasonapp2 --resource ubuntu
Here is my result:
C:\Users>az appservice web source-control config --repo-url https://www.dropbox.com/sh/ar7n31ozqgchnb2/AABxdZN4v4pklk3USCnFBWdVa?dl=0 --repository-type mercurial --name jasonapp2 --resource ubuntu
{
"branch": null,
"deploymentRollbackEnabled": false,
"id": "/subscriptions/5384xxxx-xxxx-xxxx-xxxx-0361e29a7b15/resourceGroups/ubuntu/providers/Microsoft.Web/sites/jasonapp2/sourcecontrols/web",
"isManualIntegration": false,
"isMercurial": false,
"kind": null,
"location": "Central US",
"name": "jasonapp2",
"repoUrl": "https://www.dropbox.com/sh/ar7n31ozqgchnb2/AABxdZN4v4pklk3USCnFBWdVa?dl=0",
"resourceGroup": "ubuntu",
"tags": {
"hidden-related:/subscriptions/5384xxxx-xxxx-xxxx-xxxx-0361e29a7b15/resourcegroups/AppResource/providers/Microsoft.Web/serverfarms/palian160919": "empty"
},
"type": "Microsoft.Web/sites/sourcecontrols"
}

Resources