0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure Communication Service を使って curl で Email 送信

Posted at

はじめに

Azure Communication Service で Email 送信を試す場合、基本的には下記ドキュメントにあるように Az CLI や、各言語の SDK を利用すればよいものとなります。

image.png

この記事ではシェルスクリプトおよび curl を利用してACSのメール送信APIを呼び出す方法を記載します。
なお、ポータルでは以下のようなサンプルが表示されます。しかしそのままターミナルから実行しても認証がとおりません。

image.png

ACS のメール送信 API を呼び出すには何が必要か

REST API Spec

API 定義は上記のとおりです。

認証方法

上記ドキュメントにあるとおり、Azure Communication Service では、Emailサービスに限らず、RestAPI を呼び出す場合は、HMAC SHA256 署名されてる必要があります。

サンプルとして下記のドキュメントがありますが、C# と Python の例のみとなり、Shell でどうやるのかいまいちはっきりしません。

なお、Azure Communication Service 以外にも同様の認証方式が用いられている Azure サービスもあり、下記の App Configuration のサンプルが参考になります。

サンプル

Copilotに相談しながらできたスクリプトが以下です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?