<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can I create a serverless budget policy via Python SDK on Azure Databricks? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-i-create-a-serverless-budget-policy-via-python-sdk-on-azure/m-p/142344#M51921</link>
    <description>&lt;P&gt;Hi, from the documentation I've found internally, as this feature is still in public previewbudget policy creation via the SDK is not currently supported. You can try using it via the rest API instead however this also could not yet be rolled out to your workspace.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import requests

# Replace these with your actual values
ACCOUNT_ID = 'your_account_id'
TOKEN = 'your_databricks_oauth_token' # Must have billing admin privileges

# Endpoint for budget policy creation
endpoint = f'https://accounts.azuredatabricks.net/api/2.0/accounts/{ACCOUNT_ID}/budget-policies'

# Customize the payload as needed for your budget policy
payload = {
    "name": "Serverless Budget Policy Q4",
    "description": "Control spend for serverless endpoints in Q4",
    "budget": {
        "amount": 5000,
        "currency_code": "GBP"
    },
    "targets": [
        {
            "type": "ENDPOINT",
            "resource_type": "VECTOR_SEARCH", 
            # or "SERVERLESS_COMPUTE" depending on what you intend
            "resource_id": "vs-1234567890abcdef"
        }
    ],
    "actions": [
        {
            "action_type": "NOTIFY",
            "threshold_percent": 80,
            "notification_emails": ["emma.stowell@databricks.com"]
        }
    ]
}

# Headers for authentication and content type
headers = {
    "Authorization": f"Bearer {TOKEN}",
    "Content-Type": "application/json"
}

response = requests.post(endpoint, json=payload, headers=headers)

if response.ok:
    print("Budget policy created:", response.json())
else:
    print("Error creating policy:", response.status_code, response.text)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Dec 2025 09:38:47 GMT</pubDate>
    <dc:creator>emma_s</dc:creator>
    <dc:date>2025-12-22T09:38:47Z</dc:date>
    <item>
      <title>Can I create a serverless budget policy via Python SDK on Azure Databricks?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-i-create-a-serverless-budget-policy-via-python-sdk-on-azure/m-p/142276#M51911</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, I am trying to use the Databricks Python SDK (v0.74.0) to automate the creation of budget policies in our Databricks account. See the Python code below where I am trying to create a serverless budget policy. Note the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;When I click the "Diagnose error" button, the Databricks Assistant provides the following information:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;The error NotFound: Bad Target: /api/2.1/accounts/.../budget-policies indicates that the API endpoint you are calling does not exist or is not enabled for your account. This is likely because serverless budget policies are only available for specific resources (like serverless compute or Mosaic AI Vector Search endpoints), and you must have the correct permissions and use the correct API or SDK method to create them&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;To fix this:&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;Ensure you are a workspace admin and have the Billing admin account-level role in the Databricks account console.&lt;/EM&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;Double-check that your use case is supported (e.g., serverless compute or Vector Search endpoints).&lt;/EM&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;If you are trying to set a budget policy for a Vector Search endpoint, use the correct SDK or REST API as described in the documentation.&lt;/EM&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#339966"&gt;&lt;FONT color="#339966"&gt;&lt;EM&gt;If you are not working with serverless compute or Vector Search, budget policies may not be available for your resource.&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;SPAN&gt;I can create a serverless budget policy via the Databricks UI. I am on the Azure Databricks platform. I have the account admin and billing admin roles at the account level. I am a workspace admin. Is it not possible to create a serverless budget policy via the Python SDK? It seems the backend API endpoint does not exist in our environment. Anyone else run into this issue?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ScottH_0-1766168891911.png" style="width: 660px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/22433iB28A548E3FFA4D77/image-dimensions/660x561?v=v2" width="660" height="561" role="button" title="ScottH_0-1766168891911.png" alt="ScottH_0-1766168891911.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 18:39:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-i-create-a-serverless-budget-policy-via-python-sdk-on-azure/m-p/142276#M51911</guid>
      <dc:creator>ScottH</dc:creator>
      <dc:date>2025-12-19T18:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can I create a serverless budget policy via Python SDK on Azure Databricks?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-i-create-a-serverless-budget-policy-via-python-sdk-on-azure/m-p/142344#M51921</link>
      <description>&lt;P&gt;Hi, from the documentation I've found internally, as this feature is still in public previewbudget policy creation via the SDK is not currently supported. You can try using it via the rest API instead however this also could not yet be rolled out to your workspace.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import requests

# Replace these with your actual values
ACCOUNT_ID = 'your_account_id'
TOKEN = 'your_databricks_oauth_token' # Must have billing admin privileges

# Endpoint for budget policy creation
endpoint = f'https://accounts.azuredatabricks.net/api/2.0/accounts/{ACCOUNT_ID}/budget-policies'

# Customize the payload as needed for your budget policy
payload = {
    "name": "Serverless Budget Policy Q4",
    "description": "Control spend for serverless endpoints in Q4",
    "budget": {
        "amount": 5000,
        "currency_code": "GBP"
    },
    "targets": [
        {
            "type": "ENDPOINT",
            "resource_type": "VECTOR_SEARCH", 
            # or "SERVERLESS_COMPUTE" depending on what you intend
            "resource_id": "vs-1234567890abcdef"
        }
    ],
    "actions": [
        {
            "action_type": "NOTIFY",
            "threshold_percent": 80,
            "notification_emails": ["emma.stowell@databricks.com"]
        }
    ]
}

# Headers for authentication and content type
headers = {
    "Authorization": f"Bearer {TOKEN}",
    "Content-Type": "application/json"
}

response = requests.post(endpoint, json=payload, headers=headers)

if response.ok:
    print("Budget policy created:", response.json())
else:
    print("Error creating policy:", response.status_code, response.text)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2025 09:38:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-i-create-a-serverless-budget-policy-via-python-sdk-on-azure/m-p/142344#M51921</guid>
      <dc:creator>emma_s</dc:creator>
      <dc:date>2025-12-22T09:38:47Z</dc:date>
    </item>
  </channel>
</rss>

