Skip to content

Commit e50daf7

Browse files
authored
Merge pull request #19 from ajpeacock0/ajpeacock0/acs_mgmt_adding_samples
Adding the ACS Python MGMT samples
2 parents faa20f0 + a077172 commit e50daf7

File tree

6 files changed

+926
-0
lines changed

6 files changed

+926
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This repo contains code samples that demonstrate the usage of management client
55
To find the code samples for a particular service you are using, please click on the folder that you're interested in. Each folder name is based on the Azure service, eg. Compute / Network / Storage
66

77
Samples:
8+
- [Communication](https://github.com/Azure-Samples/azure-samples-python-management/tree/master/samples/communication)
89
- [Compute](https://github.com/Azure-Samples/azure-samples-python-management/tree/master/samples/compute)
910
- [Network](https://github.com/Azure-Samples/azure-samples-python-management/tree/master/samples/network)
1011
- [Resources](https://github.com/Azure-Samples/azure-samples-python-management/tree/master/samples/resources)

samples/communication/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
page_type: sample
3+
languages:
4+
- python
5+
products:
6+
- azure
7+
description: "These code samples will show you how to manage Communication Service resources using Azure SDK for Python."
8+
urlFragment: communication
9+
---
10+
11+
# Getting started - Managing Azure Communication Services using Azure Python SDK
12+
13+
These code samples will show you how to manage Communication Service resources using Azure SDK for Python.
14+
15+
## Features
16+
17+
This project framework provides examples for the following services:
18+
19+
### Communication
20+
21+
* Using the Azure SDK for Python - Communication Management Library [azure-mgmt-communication](https://pypi.org/project/azure-mgmt-communication/) for the [Azure Communication API](https://docs.microsoft.com/en-us/rest/api/communication/)
22+
23+
## Getting Started
24+
25+
### Prerequisites
26+
27+
1. Before we run the samples, we need to make sure we have setup the credentials. Follow the instructions in
28+
[register a new application using Azure
29+
portal](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal)
30+
to obtain `subscription id`,`client id`,`client secret`, and `application id`
31+
32+
2. Store your credentials an environment variables.
33+
For example, in Linux-based OS, you can do
34+
35+
```bash
36+
export AZURE_TENANT_ID="xxx"
37+
export AZURE_CLIENT_ID="xxx"
38+
export AZURE_CLIENT_SECRET="xxx"
39+
export AZURE_SUBSCRIPTION_ID="xxx"
40+
export AZURE_NOTIFICATION_HUB_ID="xxx"
41+
export AZURE_NOTIFICATION_HUB_CONNECTION_STRING="xxx"
42+
```
43+
44+
### Installation
45+
46+
1. If you don't already have it, [install Python](https://www.python.org/downloads/).
47+
48+
This sample (and the SDK) is compatible with Python 2.7, 3.3, 3.4, 3.5 and 3.6.
49+
50+
2. General recommendation for Python development is to use a Virtual Environment.
51+
For more information, see https://docs.python.org/3/tutorial/venv.html
52+
53+
Install and initialize the virtual environment with the "venv" module on Python 3 (you must install
54+
[virtualenv](https://pypi.python.org/pypi/virtualenv) for Python 2.7):
55+
56+
```
57+
python -m venv mytestenv # Might be "python3" or "py -3.6" depending on your Python installation
58+
cd mytestenv
59+
source bin/activate # Linux shell (Bash, ZSH, etc.) only
60+
./scripts/activate # PowerShell only
61+
./scripts/activate.bat # Windows CMD only
62+
```
63+
64+
### Quickstart
65+
66+
1. Clone the repository.
67+
68+
```
69+
git clone https://github.com/Azure-Samples/azure-samples-python-management.git
70+
```
71+
72+
2. Install the dependencies using pip.
73+
74+
```
75+
cd azure-samples-python-management/samples/communication
76+
pip install -r requirements.txt
77+
```
78+
79+
## Demo
80+
81+
A demo app is included to show how to use the project. This app covers the following scenarios:
82+
83+
- Create a Communication Service
84+
- Fetch a Communication Service
85+
- Update a Communication Service
86+
- Delete a Communication Service
87+
- List all Communication Services in the subscription
88+
- List all Communication Services in the resource group
89+
- List the Primary and Secondary key pairs
90+
- Regenerate the Primary or Secondary key pair
91+
- Link a Notification Hub to the Communication Service
92+
93+
To view all available commands for the demo, execute `python manage_communication.py -h`
94+
95+
To run the complete demo, execute `python manage_communication.py all`
96+
97+
The sample files do not have dependency each other and each file represents an individual end-to-end scenario.
98+
Please look at the sample that contains the scenario you are interested in
99+
100+
## Resources
101+
102+
- https://github.com/Azure/azure-sdk-for-python

0 commit comments

Comments
 (0)