This class is needed for all SMS functionality. The following classes and interfaces handle some of the major features of the Azure Communication Services SMS SDK for C#. dotnet add package -version 1.0.0Īdd a using directive to the top of Program.cs to include the Azure.Communication namespace. NET package by using the following command. While still in the application directory, install the Azure Communication Services SMS SDK for. dotnet new console -o SmsQuickstartĬhange your directory to the newly created app folder and use the dotnet build command to compile your application. This command creates a simple "Hello World" C# project with a single source file, Program.cs. In a console window, such as cmd, PowerShell, or Bash, use the dotnet new command to create a new console app with the name SmsQuickstart. To set up an environment for sending messages, take the steps in the following sections. In the navigation pane on the left, select Phone numbers. To view the phone numbers that are associated with your Communication Services resource, sign in to the Azure portal and locate your Communication Services resource.In a terminal or command window, run the dotnet command to check that the.Replace with a phone number that you'd like to send a message to.įind the finalized code for this quickstart on GitHub.Replace with an SMS-enabled phone number that's associated with your Communication Services resource.az communication sms send -sender "" -recipient "" -message "Hello world via SMS for Azure CLI!" -connection-string "" To send an SMS message to a single recipient, call the send method from the sms module with a single recipient phone number. If you created the environment variable with your IDE open, you may need to close and reopen the editor, IDE, or shell in order to access the variable. bash_profile, and add the environment variable: export AZURE_COMMUNICATION_CONNECTION_STRING=""Īfter you add the environment variable, run source ~/.bash_profile from your console window to make the changes effective. If you created the environment variable with your IDE open, you may need to close and reopen the editor, IDE, or shell in order to access the variable.Įdit your. zshrc, and add the environment variable: export AZURE_COMMUNICATION_CONNECTION_STRING=""Īfter you add the environment variable, run source ~/.zshrc from your console window to make the changes effective. For example, if you're using Visual Studio as your editor, restart Visual Studio before running the example.Įdit your. Open a console window and enter the following command: setx AZURE_COMMUNICATION_CONNECTION_STRING ""Īfter you add the environment variable, you may need to restart any running programs that will need to read the environment variable, including the console window. Replace with your actual connection string. To configure an environment variable, open a console window and select your operating system from the below tabs. You can configure the AZURE_COMMUNICATION_CONNECTION_STRING environment variable to use Azure CLI sms operations without having to use -connection_string to pass in the connection string. (Optional) Use Azure CLI sms operations without passing in a connection string You need to replace with your actual subscription ID, which you can find in the Subscriptions section in Azure portal. If you need to change subscription, you can do that by running the following command. In a terminal or command windows, run the following command to check the current subscription. If you have multiple subscriptions in your account, make sure that you're using the correct one for this tutorial. Make sure you're using the correct subscription You can sign in running the az login command from the terminal and providing your credentials. Run the following command in a terminal or command window to install the communication module. Setting up Install the communication module
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |