You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

关于通过API/PowerShell访问Cloudyn并集成Datadog的技术咨询

Great questions—let's break this down clearly for you, since Cloudyn's full integration into Azure Cost Management + Billing changes some of the tools you'll rely on.

Accessing Cloudyn Data via PowerShell

Absolutely, but you'll want to use Azure's native PowerShell modules rather than standalone Cloudyn tools (since Cloudyn is now part of Azure Cost Management):

  • The Az.CostManagement module gives you direct access to the same cost and utilization data that was shown in the Cloudyn dashboard. You'll need the appropriate permissions (like Cost Management Reader or Contributor) on your Azure subscription first.
  • Here's a sample script to pull monthly Azure storage cost data, mirroring what you'd see in Cloudyn:
    # Connect to your Azure account (use Connect-AzAccount -TenantId <tenant-id> if needed)
    Connect-AzAccount
    
    # Define your subscription scope and time period (last 3 months, monthly granularity)
    $subscriptionScope = "/subscriptions/your-subscription-id-here"
    $startDate = (Get-Date).AddMonths(-3).ToString("yyyy-MM-dd")
    $endDate = (Get-Date).ToString("yyyy-MM-dd")
    
    # Fetch aggregated monthly storage cost data
    Get-AzCostManagementQuery -Scope $subscriptionScope `
      -TimePeriod (New-Object Microsoft.Azure.Commands.CostManagement.Models.PSQueryTimePeriod -ArgumentList $startDate, $endDate) `
      -Dataset (New-Object Microsoft.Azure.Commands.CostManagement.Models.PSQueryDataset -Property @{
        Granularity = "Monthly"
        Aggregation = @{ TotalCost = @{ Name = "Cost"; Function = "Sum" } }
        Filter = @{
          Dimensions = @{ Name = "ResourceType"; Operator = "In"; Values = @("Microsoft.Storage/storageAccounts") }
        }
      })
    
  • This script returns summed monthly costs for all your storage accounts, which you can further filter or export as needed.
Cloudyn API for Datadog Integration

Yes, but again, the Azure Cost Management REST API is the recommended replacement for the legacy Cloudyn API (which is deprecated but still functional for now):

  • For integrating with Datadog, you have two solid approaches:
    1. Custom Datadog Check: Write a script (Python, shell, etc.) that authenticates with Azure, calls the Cost Management API to fetch storage cost/utilization data, then sends that data to Datadog using their API or dogstatsd. Schedule this script to run periodically (e.g., monthly) via cron, Azure Functions, or Datadog's own scheduled tasks.
    2. Azure Logic Apps: Build a no-code workflow that triggers on a schedule, pulls data from the Cost Management API, transforms it to match Datadog's metric format, and pushes it directly to Datadog's endpoint. This is great if you don't want to maintain custom code.
  • If you must use the legacy Cloudyn API, you can authenticate with your Cloudyn credentials and use endpoints like /api/v1/reports/cost to pull structured data. Just note that Microsoft will eventually retire this API, so migrating to Azure's native API is better for long-term support.
  • When sending data to Datadog, include tags like subscription-id, storage-account-name, and resource-group to make your metrics more actionable in Datadog's dashboard.

内容的提问来源于stack exchange,提问作者Manjunath Rao

火山引擎 最新活动