suse-enceladus / csp-billing-adapter-microsoft Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
A few difference exist in how the token, resourceURI and plan are collected from a Azure Manager Kubernetes Application and a standard Azure Managed (VM).
In order for the token to be retrieved, the VM must have Azure System Identity assigned
For the Managed Application, the token needs to be acquired by using resource=https://management.azure.com
and not needing a client id https://github.com/SUSE-Enceladus/csp-billing-adapter-microsoft/blob/main/csp_billing_adapter_microsoft/plugin.py#L211
I believe the method for getting the planID can leverage the metadata as it has some "plan" data in the metadata.
{"compute":{"azEnvironment":"AzurePublicCloud","customData":"","location":"eastus","name":"linux-vm","offer":"manager-server-4-3-llc-image","osType":"Linux","placementGroupId":"","plan":{"name":"gen2","product":"manager-server-4-3-llc-image","publisher":"suse"}
managedBy field
from following the example at the URL above."https://management.azure.com/subscriptions/" + $metadata.compute.subscriptionId + "/resourceGroups/" + $metadata.compute.resourceGroupName + "?api-version=2019-10-01"
but for some reason, even with a managed identity assigned I am getting
{"error":{"code":"AuthorizationFailed","message":"The client 'XXXXXXXXXXXXXX' with object id 'XXXXXXXXXXXXXXXXX' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourceGroups/read' over scope '/subscriptions/XXXXXXXXXXX/resourceGroups/mrg-manager-server-4-3-llc-preview-20231006090809' or the scope is invalid. If access was recently granted, please refresh your credentials."}}
This will need to be figured out.
{
"resourceId": <guid>, // unique identifier of the resource against which usage is emitted.
"quantity": 5.0, // how many units were consumed for the date and hour specified in effectiveStartTime, must be greater than 0 or a double integer
"dimension": "dim1", // custom dimension identifier
"effectiveStartTime": "2018-12-01T08:30:14", // time in UTC when the usage event occurred, from now and until 24 hours back
"planId": "plan1", // id of the plan purchased for the offer
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.