Git Product home page Git Product logo

Comments (15)

mivano avatar mivano commented on May 27, 2024 2

Version 0.38.0 should contain the ability to change the base urls via the config param. See the readme for the options.

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024 1

At the moment, there is no CLI switch for it. So if you can run the source, you can change the url here: https://github.com/mivano/azure-cost-cli/blob/main/src/Program.cs#L24
If that works, I can introduce an override.

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024 1

According to this page (https://learn.microsoft.com/en-gb/azure/azure-government/compare-azure-government-global-azure#guidance-for-developers) it should be that URL.

What you can do: when in the Azure portal (the government one), go the the Cost management page and inspect the network traffic and see where the calls to the Query endpoint go to.

image

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024 1

Ah that is good to hear. I see in the diff what you changed, so I have to see how I can make this configurable. Give me some time please as I m traveling at the moment.

from azure-cost-cli.

welcome avatar welcome commented on May 27, 2024

Thanks for opening your first issue! Reports like these help improve the project!

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024

Unfortunately, it can not. It connects to the public cloud version only. I do not have a Government Cloud account, so I m unsure if the same calls can be made. If so, it might be an option to change the base url to try out?

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

That's exciting! According to their documentation here: Compare Azure Government and global Azure
, updating that to management.usgovcloudapi.net should work. I'm going to try it out today and report back. Thank you!

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024

I m assuming it is similar for the other clouds (like German), but I m unable to verify, so do let me know and I will see how we can add an override in.

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

So I forked it and made the change, but as I am not a developer, I cannot seem to figure out how to compile it into a binary :/

I am running ubuntu 22.04.4 LTS and have dotnet and cmake installed, but I'm not sure how to create a usable executable from the code/Program.cs file. I'm doing my best to check around the internet, but if you could provide me with some guidance, that would surely be much appreciated.

Thanks in advance :)

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024

From the src folder, you should be able to execute dotnet run, optionally passing in --framework net6.0. This will build and run the application. The binary can be found in the bin/debug/netx folder (azure-cost).

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

Is this meaningful output? I did run az login --scope management.usgovcloudapi.net/.default with a successful login once also updating the url here: https://github.com/mivano/azure-cost-cli/blob/main/src/CostApi/AzureCostApiRetriever.cs#L60

user@jammy-gcch:~/git/src$ dotnet run --framework net6.0
/home/user/.nuget/packages/microsoft.build.tasks.git/8.0.0/build/Microsoft.Build.Tasks.Git.targets(25,5): warning : Repository '/home/user/git' has no remote. [/home/user/git/src/azure-cost-cli.csproj::TargetFramework=net6.0]
/home/user/.nuget/packages/microsoft.sourcelink.common/8.0.0/build/Microsoft.SourceLink.Common.targets(53,5): warning : Source control information is not available - the generated source link is empty. [/home/user/git/src/azure-cost-cli.csproj::TargetFramework=net6.0]
Unhandled exception. System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at AzureCostCli.CostApi.AzureCostApiRetriever.ExecuteCallToCostApi(Boolean includeDebugOutput, Object payload, Uri uri) in /home/user/git/src/CostApi/AzureCostApiRetriever.cs:line 150
   at AzureCostCli.CostApi.AzureCostApiRetriever.RetrieveCosts(Boolean includeDebugOutput, Scope scope, String[] filter, MetricType metric, TimeframeType timeFrame, DateOnly from, DateOnly to) in /home/user/git/src/CostApi/AzureCostApiRetriever.cs:line 200
   at AzureCostCli.Commands.AccumulatedCost.AccumulatedCostCommand.<>c__DisplayClass4_0.<<ExecuteAsync>b__0>d.MoveNext() in /home/user/git/src/Commands/AccumulatedCost/AccumulatedCostCommand.cs:line 107
--- End of stack trace from previous location ---
   at AzureCostCli.OutputFormatters.SpectreConsole.StatusExt.<>c__DisplayClass16_0.<<StartAsync>b__0>d.MoveNext() in /home/user/git/src/OutputFormatters/SpectreConsole/StatusExt.cs:line 99
--- End of stack trace from previous location ---
   at AzureCostCli.OutputFormatters.SpectreConsole.StatusExt.<>c__DisplayClass17_0`1.<<StartAsync>b__0>d.MoveNext() in /home/user/git/src/OutputFormatters/SpectreConsole/StatusExt.cs:line 141
--- End of stack trace from previous location ---
   at Spectre.Console.Progress.<>c__DisplayClass32_0`1.<<StartAsync>b__0>d.MoveNext() in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 138
--- End of stack trace from previous location ---
   at Spectre.Console.Internal.DefaultExclusivityMode.RunAsync[T](Func`1 func) in /_/src/Spectre.Console/Internal/DefaultExclusivityMode.cs:line 40
   at Spectre.Console.Progress.StartAsync[T](Func`2 action) in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 121
   at AzureCostCli.OutputFormatters.SpectreConsole.StatusExt.StartAsync[T](String status, Func`2 func) in /home/user/git/src/OutputFormatters/SpectreConsole/StatusExt.cs:line 138
   at AzureCostCli.OutputFormatters.SpectreConsole.StatusExt.StartAsync(String status, Func`2 action) in /home/user/git/src/OutputFormatters/SpectreConsole/StatusExt.cs:line 97
   at AzureCostCli.Commands.AccumulatedCost.AccumulatedCostCommand.ExecuteAsync(CommandContext context, AccumulatedCostSettings settings) in /home/user/git/src/Commands/AccumulatedCost/AccumulatedCostCommand.cs:line 88
   at Spectre.Console.Cli.CommandExecutor.Execute(IConfiguration configuration, IEnumerable`1 args) in /_/src/Spectre.Console.Cli/Internal/CommandExecutor.cs:line 83
   at Spectre.Console.Cli.CommandApp.RunAsync(IEnumerable`1 args) in /_/src/Spectre.Console.Cli/CommandApp.cs:line 84
   at Program.<Main>$(String[] args) in /home/user/git/src/Program.cs:line 115

Is there something else you wold like me to try?

from azure-cost-cli.

mivano avatar mivano commented on May 27, 2024

What did you change the url to? So the one that is used by the RetrieveCosts call? A 404 indicates that it cannot find it.

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

management.usgovcloudapi.net

I suppose we are at a dead end then. Thank you for the assistance ☺️

from azure-cost-cli.

Bakan0 avatar Bakan0 commented on May 27, 2024

Hello again! Good news I believe! I had to supply the subscription id, since ours differs from our tenant id, but by running this command:
dotnet run --framework net6.0 costByTag --tag CostCenter --tag costcenter-tag-for-IT -s our-subscription-id

2024-03-14-234900

I think I just need to figure out the querying, and I may be actually able to pull some useful data!! Thank you for your assistance! I'm not sure if I should close this issue or not. I'm also not very sure how to share the changes made with you, but you can see them over at my fork, since that's what I'm using: https://github.com/Bakan0/azure-cost-cli/tree/main

from azure-cost-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.