<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6" -->

---
title: Using multiline Parameters for Aspire and ASP.NET Core...
description: Aspire does not support multiline configuration values such as PEM certificates out of the box. A workaround base64-encodes the multiline secret before passing...
canonical: https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Using multiline Parameters for Aspire and ASP.NET Core with user secrets and Azure default deployments | daily.dev
og:description: Aspire does not support multiline configuration values such as PEM certificates out of the box. A workaround base64-encodes the multiline secret before passing...
og:url: https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6
og:image: https://api.daily.dev/og/posts/74p5T7Ok6.png
og:image:alt: Using multiline Parameters for Aspire and ASP.NET Core with user secrets and Azure default deployments
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Using multiline Parameters for Aspire and ASP.NET Core with user secrets and Azure default deployments

**[Damien Bowden](https://daily.dev/sources/damienbod)** · 3 min read · 0 upvotes · 0 comments

## Summary

Aspire does not support multiline configuration values such as PEM certificates out of the box. A workaround base64-encodes the multiline secret before passing it as an Aspire parameter, then decodes it at runtime using a small ConfigConverter helper class. This approach works consistently across local development with user secrets, Linux and Windows containers, and Azure default deployments, avoiding manual configuration steps after deployment.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://damienbod.com/2026/09/01/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deployments>

## Questions this post answers

### why don't multiline PEM certificate values work with Aspire parameters

Aspire has a bug where multiline secrets or configuration values, such as PEM certificate files, do not work correctly by default when set as parameters. The workaround is to base64-encode the multiline value before storing it as an Aspire parameter, then decode it back to the original PEM string at runtime using a helper class, which works across local user secrets and Azure deployments.

_daily.dev surfaces workarounds like this for developers debugging Aspire configuration quirks._

### how do I pass a PEM certificate as a secret parameter in .NET Aspire

Encode the PEM content as a base64 string, add it with builder.AddParameter using secret: true, then pass it to the project with WithEnvironment in the Aspire AppHost. At runtime, decode the base64 string back to the PEM format using Convert.FromBase64String and Encoding.UTF8.GetString before creating the certificate with X509Certificate2.CreateFromPem.

_developers wiring secrets into Aspire-hosted services can track patterns like this on daily.dev._

## Similar posts on daily.dev

- ["We Store Secrets in appsettings.json": A Horror Story in Five Acts — Daily DevOps & .NET](https://daily.dev/posts/we-store-secrets-in-appsettings-json-a-horror-story-in-five-acts-daily-devops-net-us10y5dmd) · We Are .NET · 1 upvotes · 0 comments
- [.NET Aspire 6: Deployment Using Azure Container Apps](https://daily.dev/posts/net-aspire-6-deployment-using-azure-container-apps-ajnipjxrw) · Telerik · 0 upvotes · 0 comments
- [How to Improve Developer Experience in Microservices Applications with .NET Aspire](https://daily.dev/posts/how-to-improve-developer-experience-in-microservices-applications-with-net-aspire-o3dcliqyw) · freeCodeCamp · 6 upvotes · 0 comments

---

Tags: [#azure](https://daily.dev/tags/azure), [#c#](https://daily.dev/tags/c#), [#aspnet](https://daily.dev/tags/aspnet)

[View this post on daily.dev](https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Using multiline Parameters for Aspire and ASP.NET Core with user secrets and Azure default deployments","url":"https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6"},"datePublished":"2026-10-04T13:04:06.334Z","dateModified":"2026-10-04T13:04:27.037Z","description":"Aspire does not support multiline configuration values such as PEM certificates out of the box. A workaround base64-encodes the multiline secret before passing...","image":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","thumbnailUrl":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","isAccessibleForFree":true,"articleSection":"Damien Bowden","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Damien Bowden","logo":"https://media.daily.dev/image/upload/s--MpH73n5h--/f_auto,q_auto/v1791119042/logos/damienbod?_a=BAMAMicg0","url":"https://daily.dev/sources/damienbod"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"azure,c#,aspnet","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Damien Bowden","item":"https://daily.dev/sources/damienbod"},{"@type":"ListItem","position":3,"name":"Using multiline Parameters for Aspire and ASP.NET Core with user secrets and Azure default deployments"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/using-multiline-parameters-for-aspire-and-asp-net-core-with-user-secrets-and-azure-default-deploymen-74p5t7ok6#faq","mainEntity":[{"@type":"Question","name":"why don't multiline PEM certificate values work with Aspire parameters","acceptedAnswer":{"@type":"Answer","text":"Aspire has a bug where multiline secrets or configuration values, such as PEM certificate files, do not work correctly by default when set as parameters. The workaround is to base64-encode the multiline value before storing it as an Aspire parameter, then decode it back to the original PEM string at runtime using a helper class, which works across local user secrets and Azure deployments. daily.dev surfaces workarounds like this for developers debugging Aspire configuration quirks."}},{"@type":"Question","name":"how do I pass a PEM certificate as a secret parameter in .NET Aspire","acceptedAnswer":{"@type":"Answer","text":"Encode the PEM content as a base64 string, add it with builder.AddParameter using secret: true, then pass it to the project with WithEnvironment in the Aspire AppHost. At runtime, decode the base64 string back to the PEM format using Convert.FromBase64String and Encoding.UTF8.GetString before creating the certificate with X509Certificate2.CreateFromPem. developers wiring secrets into Aspire-hosted services can track patterns like this on daily.dev."}}]}
```

