web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom connector C# co...
Power Automate
Unanswered

Custom connector C# code doesn't suport RSA function?

(0) ShareShare
ReportReport
Posted on by 367

Hi expert,

 

I creating custom connector that require custom code

 

 

 

 

using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using System.Text;
using Newtonsoft.Json;

public class Script : ScriptBase
{
 // Some code here

 private static string SignData(string data, string privateKey)
 {
 using (RSA rsa = RSA.Create())
 {
 rsa.ImportFromPem(privateKey.ToCharArray());
 var signatureBytes = rsa.SignData(Encoding.UTF8.GetBytes(data), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
 return Base64UrlEncode(Convert.ToBase64String(signatureBytes));
 }
 }
}

 

 

 

 

It don't let me save the code with error "Failed to provision compute for custom code. Request failed with error 'Code: BadRequest. Message: script.csx(95,13): error CS1061: 'RSA' does not contain a definition for 'ImportFromPem' and no accessible extension method 'ImportFromPem' accepting a first argument of type 'RSA' could be found (are you missing a using directive or an assembly reference?).'

 

I have tried this code in Visual Studio and its work fine without an problem, I checked all limitation and all those namespace should supported by custom code, No idea why it causing error.

 

Any advice would be appreciated.

 

Thank you.

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard