How to install Azure CLI Billing Account - azure

I am trying to run
az billing account list
However, when I run this I get:
az billing: 'account' is not in the 'az billing' command group. See 'az billing --help'. If the command is from an extension, please make sure the corresponding extension is installed. To learn more about extensions, please visit https://learn.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
I have installed the account extension but it still has not worked.
If I run it in the Cloud Shell I get:
Command group 'billing account' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
[]
so I do get a response here.
I cannot find anything to install this extension or preview extentions.
Repo doesn't have it https://github.com/Azure/azure-cli
Python Repo doesn't have it https://pypi.org/user/microsoft/
No information on the Documentation https://learn.microsoft.com/en-us/rest/api/billing/2019-10-01-preview/billingaccounts
listing the extensions doesn't show anyting https://learn.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview

The upgraded billing commands are shipped with Azure CLI 2.15.0 and the Cloud Shell you are using with Azure might be an older version, Try to update and see

Related

Has az login stopped working in Ubuntu 20.04?

I have used the azure command line some months back without problems. Today I needed to use it again. Nothing has changed in my system, and I am still using the same organization.
I run az login from my terminal (Ubuntu 20.04) and I am shown a browser window. I login to my Azure account. The page replies with:
You have logged into Microsoft Azure! You can close this window, or we
will redirect you to the Azure CLI documents in 10 seconds.
The terminal then displays the authentication reply (a long json response). So far so good.
Now I try to do something with the azure cli, in this case trigger a pipeline:
az pipelines run --output table --organization https://dev.azure.com/MyOrg/ --project MyProj --name MyRepo --branch refs/heads/y/branch --open
But it complains with:
Before you can run Azure DevOps commands, you need to run the login command(az login if using AAD/MSA identity else az devops login
if using PAT token) to setup credentials. Please see
https://aka.ms/azure-devops-cli-auth for more information.
This was not the case some months back. What happened here?
EDIT
This is my az cli:
ยป az --version
azure-cli 2.34.1
core 2.34.1
telemetry 1.0.6
Extensions:
azure-devops 0.18.0
Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0
Python location '/opt/az/bin/python3'
Extensions directory '/home/theuser/.azure/cliextensions'
Python (Linux) 3.8.12 (default, Mar 2 2022, 07:26:21)
[GCC 9.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
I have tried the same ,to upgrade my CLI version and it failed several times and now only got succeed the error might be you are getting due to some recent changes still going on with 2.34.1 version.
Would suggest you use the old version of CLI and then check or, for Workaround you can use az devops login using PAT token .
You can refer the same document to login with PAT which one you are getting in an error .
For more information please refer this GitHub issue as suggested by #wiruzman

Error when install Azure-Cli on my self hosted windows agent

I have Azure DevOps pipelines using my Windows Self-hosted agent on my intranet.
I want pipelines to create universal packages and I read that I must install an extension to Azure-Cli on the agent for this.
After several errors where system team helped me setup proxy and all, I run this command in elevated command prompt:
az extension add --name azure-devops
I have this error message:
Unable to get extension index.
Response body does not contain valid json. Error detail: Expecting value: line 1 column 1 (char 0)
What could be the issue ?
First of all, as Doris said, you need meet the most basic conditions for installing the azure-devops extension, that is, the version of az cli should be higher than 2.0.69. But as far as I know, this should not be the cause of issue you encountered.
azure cli along with extensions are all built with python. So you will find that "Error detail: Expecting value: line 1 column 1 (char 0)" is a normal JSONParseDecode error if you google it. It has many causes, like empty response, non-json response content, 500/503 error and etc. Without internet trace, I'm afraid it's hard to find the exact cause of it.
Work around:
========================================
To work around this issue so that you can use az devops command to achieve your goal, you can follow below steps:
1) Install the corresponding whl file into your local machine.
2) Retrieve the downloaded whl file location, then run this command from your command line(Here I would show you the sample script I used):
az extension add --source C:\Users\merlinl\Downloads\azure_devops-0.18.0-py2.py3-none-any.whl
3) Now you will see that the azure-devops installed successfully.
Check your CLI version.
You must have at least v2.0.69, which you can verify with az --version command. Refer to this.

Unable to remove faulted Node using Remove-ServiceFabricNodeState any more

I used to use Remove-ServiceFabricNodeState to remove faulted Service Fabric nodes. with this cmdlet i was able to remove a specific node by its name.
However I'm unable to use this cmdlet any more. It is not allowing me to install the module using Install-Module ServiceFabric anymore saying the module cannot be found in the gallery.
Also I'm unable to find a similar cmdlet in iether Az.ServiceFabric or az cli. all that is available is a Remove-AzServiceFabricNode which cannot specify which node I want to remove. It just accepts an integer for how many nodes I want to remove.
I would like to know how can I remove a Node by its name?
To use Remove-ServiceFabricNodeState, just need to install the Azure Service Fabric SDK, it also includes the runtime and tools, after installing it, reopen a PowerShell session, you will be able to use the command.
Besides, you can also use the Azure Service Fabric CLI command sfctl node remove-state as mentioned in another reply, all depend on your requirement.
You can use Azure Service Fabric CLI with
sfctl node remove-state --node-name Node01 --timeout 60
This will remove the state of Node1 with a timeout of 60 seconds. Documnetation
For more information on how to install sfctl see how to install sfctl
Simple version:
Install Python (Version 3.X)
Install Pip
Execute the following command pip install -I sfctl==9.0.0. See table to see which version you need.

Az powershell module availability on Microsoft hosted Agents

I have verified the installed software/packages from the link. No were mentioned Az module is available. Is Az module made available on the microsoft hosted agents? If not from when it will be available. We are using ADO custom build tasks and Azure automation accounts with Azure RM module. What should be the best migration to Az module.
Az module is available if you use the latest Azure Powershell task (AzurePowerShell#4). It would pull the Az module automatically.
Agree with #4c74356b41's answer. We have expanded and preloaded some modules in Azure Powershell#4 task, including Az module. This task would load Az cmdlets automatically which do not need you to use Install-Module cmd anymore.
If you do not want to use this task, but only Powershell task, the Az module can also be used, just use one cmd to install module firstly:
Install-Module -Name Az -AllowClobber -Force
This command can be applied in all agents, no matter it is hosted or private one.
With cmd Get-InstalledModule checked, you can see that it is installed successfully:
If you want to know the best migration to Az module, check this doc. It express the details of how should you configure the environment for the migration to succeed. And how should the migration be applied suitable when the environment meets the migration criteria.
The latest available release of AzureRM is 6.13.1. If you don't have
this version installed, your existing scripts may need additional
modification to work with the Az module beyond what's described here
and in the breaking changes list.
If your scripts don't work with AzureRM 6.13.1, update them according
to the AzureRM 5.x to 6.x migration guide. If you use an earlier
version of the AzureRM module, there are migration guides available
for each major version.
AZ is already downloaded on the agent, just not installed
Something like this could work
$env:PSModulePath += ';C:\Modules\az_7.1.0'
Write-Host "##vso[task.setvariable variable=PSModulePath;]$($Env:PSModulePath)"`

Cannot install Azure Dev Spaces using cloud shell in AKS

When i run the below command in cloud shell.
az aks use-dev-spaces -g aksrgrp -n akscluster
I get the below error. Any help will be highly appreciated
You may be prompted for your administrator password to authorize the installation process.
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 84: sudo: command not found
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 112: sudo: command not found
[INFO] Failed to install dotnet core dependencies.
[INFO] You can manually install all required dependencies based on the following documentation:
[FATAL] https://www.microsoft.com/net/download/dotnet-core/2.1
Azure Dev Spaces CLI not installed properly. Visit 'https://aka.ms/get-azds' for Azure Dev Spaces.
The error shows why the issue happens. It cannot find the command azds. Because the cloud shell does not install the command tool. You can find all the command tools installed in the cloud shell here.
I suggest you can install the tool which you need in the Azure VM of the azure Kubernetes, if you do not find the tool what you want.
It's a better way for you. By the way, the Cloud Shell just enables access to a browser-based command-line experience built with Azure management tasks in mind. So install the Azure CLI in the VM is a better experience.
To add to Charles's answer: the Azure Dev Spaces CLI currently does not support running in the Cloud Shell. Its functionality is designed more for running on your local dev machine where you application's source code is.

Resources