hystax / optscale

FinOps and cloud cost optimization tool. Supports AWS, Azure, GCP, Alibaba Cloud and Kubernetes.
https://hystax.com
Apache License 2.0
1.17k stars 164 forks source link

Azure Enterprise Agreement #48

Open jakelima18 opened 1 year ago

jakelima18 commented 1 year ago

Optscale can't read data billing from subscription Azure Enterprise Agreement. I'm suspicious that the Azure Enterprise Agreement subscription api is another API.

maxb-hystax commented 1 year ago

Hi! Azure EA subscriptions don't provide expenses data in usual way, so you need to connect such accounts with import_scheme: "raw_usage" parameter.

You can refer to https://github.com/hystax/optscale/blob/be70d943019d88a5c4ae778765a74ef66e6dca7d/diworker/diworker/importers/azure.py#LL139C2-L139C2 for the details.

jakelima18 commented 1 year ago

But how do I load this information since the console does not appear to change the schema option. It would be through https://github.com/hystax/optscale/blob/integration/optscale-deploy/overlay/user_template.yml

maxb-hystax commented 1 year ago

It should be set when calling cloud account creation or patch API. Further version which we plan to publish includes autodetection of necessary import scheme, but for now it is a manual change.

jakelima18 commented 1 year ago

by the opensource version it is not possible to make this schema configuration. Do you have any documentation of doing this creation via API?

jakelima18 commented 1 year ago

Any documentation about how use the API?

nk-hystax commented 4 days ago

You can update your existing cloud account configuration with the correct import scheme by calling PATCH <optscale_ip>/restapi/v2/cloud_accounts/<cloud_account_id> with body:

{
   "config":{
      "client_id":"<client (app) id>",
      "tenant":"<tenant>",
      "subscription_id":"<subscription_id>",
      "secret":"<secret>",
      "expense_import_scheme":"raw_usage"
   }
}

or disconnect the old cloud account and create the new one: POST <optscale_ip>/restapi/v2/organizations/<organization_id>/cloud_accounts

{
  "name": "<your cloud name>",
  "type": "azure_cnr",
  "config": {
      "client_id":"<client (app) id>",
      "tenant":"<tenant>",
      "subscription_id":"<subscription_id>",
      "secret":"<secret>",
      "expense_import_scheme":"raw_usage"
  }
}