🧭 How toDigital MarketingIntermediate✨ AI-assisted

How to Run DeepSeek on Azure AI Foundry for Marketing Copy

WittyTech Daily··5 min read
#deepseek#azure-ai-foundry#marketing-copy#content-safety

Marketing teams generating hundreds of product descriptions and ad variants a week don't need a frontier model, they need one that's fast, cheap, and doesn't say anything the legal team has to walk back. DeepSeek V4 fits that job, and Azure AI Foundry (rebranded Microsoft Foundry as of January 2026, though the ai.azure.com portal and a lot of documentation still use the old name) now hosts it as a first-party "Direct from Azure" model. Here's how to deploy DeepSeek V4 Flash, wire it into a copy pipeline that respects your brand voice, and stop it before it ships something you didn't approve.

By the end you'll have a deployed model, a working Python pipeline that turns a product row into a description and three ad variants, and a content-safety layer tuned for marketing language instead of generic chat.

1. Deploy DeepSeek V4 Flash from the Foundry model catalog

Sign in to the Microsoft Foundry portal with the New Foundry experience turned on, open Build > Model, and select Deploy base model to open the catalog. Search for DeepSeek-V4-Flash-0731, the current Direct-from-Azure release. It replaced the preview build and adds meaningfully better instruction-following and agentic behavior over the earlier R1-era models. Choose Deploy > Default settings unless you need custom SKU or region controls.

DeepSeek V4 ships in two sizes: V4 Flash (284B parameters, 13B active) for high-volume, low-latency copy, and V4 Pro (1.6T parameters, 49B active) for work that needs deeper reasoning, like drafting a comparison page against a competitor's spec sheet. For product descriptions and ad variants, Flash is the right default. It's the cheaper, faster model, and marketing copy rarely needs Pro-level reasoning or a million-token context window.

Note the deployment name shown once provisioning finishes. Everything downstream calls the model by that deployment name, not the catalog's model family name.

2. Authenticate without storing a key

Skip the API key and use Microsoft Entra ID, so nothing sits in a .env file next to your marketing copy prompts. Grant your identity the Cognitive Services User role on the Foundry resource:

az role assignment create \
  --assignee "<your-user-or-service-principal-id>" \
  --role "Cognitive Services User" \
  --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.CognitiveServices/accounts/<foundry-resource-name>"

Then point the OpenAI SDK at your Foundry endpoint using a bearer token instead of a key:

from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from openai import OpenAI
import os

credential = DefaultAzureCredential()
endpoint = os.environ["AZURE_AI_PROJECT_ENDPOINT"]  # e.g. https://<resource>.services.ai.azure.com/api/projects/<project>

client = OpenAI(
    base_url=endpoint.rstrip("/") + "/openai/v1",
    api_key=get_bearer_token_provider(credential, "https://ai.azure.com/.default"),
)

DefaultAzureCredential picks up your az login session locally and a managed identity in production, so there's no key to rotate.

3. Lock in the brand voice before you write a single prompt

Copy generated by a raw system prompt drifts fast, especially with a model your team hasn't used before. Write the voice rules once as a reusable system message and reference it on every call:

BRAND_VOICE = """
You write product marketing copy for <Brand Name>.
Tone: confident, plain-spoken, no exclamation points, no superlatives you can't prove.
Never claim a product is "the best," "guaranteed," or "clinically proven."
Always mention the product name and one concrete benefit in the first sentence.
Keep descriptions under 60 words. Ad variants under 20 words.
"""

This is what keeps 200 generated descriptions sounding like one brand instead of 200 improvised ones.

4. Build the generation pipeline

A minimal pipeline reads product rows and produces a description plus three ad variants per product:

import csv

def generate_copy(client, deployment_name, product):
    prompt = f"""
Product: {product['name']}
Key features: {product['features']}
Write one product description and three short ad variants.
"""
    response = client.chat.completions.create(
        model=deployment_name,
        messages=[
            {"role": "system", "content": BRAND_VOICE},
            {"role": "user", "content": prompt},
        ],
        temperature=0.7,
        max_tokens=400,
    )
    return response.choices[0].message.content

with open("products.csv") as f:
    for row in csv.DictReader(f):
        copy = generate_copy(client, "DeepSeek-V4-Flash-0731", row)
        print(f"--- {row['name']} ---\n{copy}\n")

Swap the print for a write into whatever queue your CMS or ad platform pulls from.

5. Add guardrails tuned for marketing, not generic chat

Foundry deployments ship with default Azure AI Content Safety filters for hate, self-harm, sexual, and violent content at medium severity, but marketing risk looks different: false claims, unapproved competitor mentions, or promises legal hasn't cleared. Layer a custom blocklist from the Guardrails & controls page in the portal, or manage it directly with the SDK:

from azure.ai.contentsafety import BlocklistClient
from azure.ai.contentsafety.models import AddOrUpdateTextBlocklistItemsOptions, TextBlocklistItem
from azure.core.credentials import AzureKeyCredential
import os

client = BlocklistClient(
    os.environ["CONTENT_SAFETY_ENDPOINT"],
    AzureKeyCredential(os.environ["CONTENT_SAFETY_KEY"]),
)

items = [
    TextBlocklistItem(text="guaranteed results"),
    TextBlocklistItem(text="clinically proven"),
    TextBlocklistItem(text="<competitor-product-name>"),
]
client.add_or_update_blocklist_items(
    blocklist_name="marketing-copy-blocklist",
    options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=items),
)

Attach the blocklist to your deployment's content filter configuration so flagged output gets rejected before it reaches your pipeline, not after a human catches it in review.

6. Route flagged and low-confidence output to a human

Don't auto-publish. Log anything the content filter flags, plus anything that runs long or short against your voice rules, into a review queue instead of straight to the CMS. For a marketing team, the failure mode isn't a model refusing to answer, it's a model confidently writing a claim nobody signed off on.

Gotchas

  • Azure's serverless pricing for DeepSeek isn't the same as DeepSeek's own API pricing, and some teams have reported it landing noticeably higher than expected. Check the Foundry pricing calculator against your real token volumes before you commit a campaign's budget to it.
  • Content filters flag normal marketing language. "Guaranteed," "best," and superlative-heavy copy can trip the default filter even when it isn't a health or safety claim. Test with real product copy before launch and tune the severity threshold if it's too aggressive.
  • The deployment name is not the model name. Your code has to reference the exact name you gave the deployment, not the catalog entry (DeepSeek-V4-Flash-0731), or calls will fail.
  • The product is now branded Microsoft Foundry, not Azure AI Foundry, even though the ai.azure.com URL and a lot of documentation still use the old name. Don't assume you're in the wrong place.

Running high-volume copy through a model this cheap only pays off if the guardrails around it are as deliberate as the prompt: cost control without brand control just means shipping bad copy faster.

← More in Digital Marketing