Giter Club home page Giter Club logo

billing-dotnet-core-invoice-download's Introduction

page_type languages products description
sample
csharp
dotnet
azure
This is a simple .NET Core sample that uses the Azure .NET SDK to programmatically get your invoices.

Get Azure invoice with .NET Core

This is a simple .NET Core sample that uses the Azure .NET SDK to programmatically get your invoices.

Run this sample

  1. Get the .NET Core SDK.

  2. Get the Account Admin of the subscription to opt in and turn on API access to invoices.

  3. Create an Azure service principal either through Azure CLI, PowerShell or the portal.

  4. Clone the repository and install dependencies

    git clone https://github.com/Azure-Samples/billing-dotnet-core-invoice-download.git
    cd billing-dotnet-core-invoice-download
    dotnet restore
  5. Edit appsettings.json using your subscription ID, tenant domain, client ID, and client secret from the service principle that you created. Example:

    {
        "TenantDomain": "yourtenant.onmicrosoft.com",
        "SubscriptionID": "your subscription ID",
        "ClientID": "your client ID",
        "ClientSecret": "your client secret"
    }
  6. Run the sample.

    dotnet run

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

billing-dotnet-core-invoice-download's People

Contributors

jlian avatar microsoftopensource avatar msftgits avatar supernova-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

billing-dotnet-core-invoice-download's Issues

Forbidden

Calling invoice service for all available invoices...

Unhandled Exception: System.AggregateException: One or more errors occurred. (Operation returned an invalid status code 'Forbidden') ---> Microsoft.Azure.Management.Billing.Models.ErrorResponseException: Operation returned an invalid status code 'Forbidden'
at Microsoft.Azure.Management.Billing.InvoicesOperations.ListWithHttpMessagesAsync(String expand, String filter, String skiptoken, Nullable1 top, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.Management.Billing.InvoicesOperationsExtensions.ListAsync(IInvoicesOperations operations, String expand, String filter, String skiptoken, Nullable1 top, CancellationToken cancellationToken) at Microsoft.Azure.Management.Billing.InvoicesOperationsExtensions.List(IInvoicesOperations operations, String expand, String filter, String skiptoken, Nullable1 top)
at billing_dotnet_invoice_api.Program.Run() in /Users/sgooch/Documents/Stash/azure/billing-dotnet-core-invoice-download/Program.cs:line 35
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at billing_dotnet_invoice_api.Program.Main(String[] args) in /Users/sgooch/Documents/Stash/azure/billing-dotnet-core-invoice-download/Program.cs:line 26

[Action Needed] This repo is inactive

This GitHub repository has been identified as a candidate for archival

This repository has had no activity in more than [x amount of time]. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.

Please see https://aka.ms/sunsetting-faq to learn more about this process.

Action

✍️

❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒

If you take no action, this repository is still inactive 30 days from today it will be automatically archived..

Need more help? 🖐️

Invalid Status Code 'NOT FOUND' at Microsoft.Azure.Management.Billing.Models.ErrorResponseException

Hi all,

After changing the app.json to pointing my Azure account. I'm getting the below error.This is due to Invoice is not present for my Azure account.So we have to handle the exception and give a meaningful error instead of full stack trace

Full Stacktrace:

Unhandled Exception: System.AggregateException: One or more errors occurred. (Operation returned an invalid status code 'NotFound') ---> Microsoft.Azure.Management.Billing.Models.ErrorResponseException: Operation returned an invalid status code 'NotFound'
   at Microsoft.Azure.Management.Billing.InvoicesOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Billing.InvoicesOperationsExtensions.<ListAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Billing.InvoicesOperationsExtensions.List(IInvoicesOperations operations, String expand, String filter, String skiptoken, Nullable`1 top)
   at billing_dotnet_invoice_api.Program.<Run>d__6.MoveNext() in D:\New folder\billing-dotnet-core-invoice-download\Program.cs:line 35
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()

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.