Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-python
Browse files Browse the repository at this point in the history
…into regenerate_secrets

* 'master' of https://github.com/Azure/azure-sdk-for-python: (39 commits)
  [text analytics] remove duplicate platform info in user agent (Azure#12123)
  [form recognizer] remove duplicate platform info in user agent (Azure#12124)
  fix broken links (Azure#12100)
  Document "<unchanged>" for DataSourceCredentials.connectionString if it is empty (Azure#12129)
  Let the transport handles bad urls (Azure#12106)
  Remove Unneeded Reference to repository resource (Azure#11929)
  enable logging for tests (Azure#12110)
  fix network in batch testcase (Azure#12114)
  update test recording for appservice (Azure#12116)
  Add test for connection monitor and fix test api version. (Azure#12113)
  Minor root readme and mgmt quickstart update for Track 2 mgmt sdk (Azure#12112)
  Quickstart for Track 2 preview management libraries and update root readme for track 2 (Azure#11384)
  Seg fault fix (Azure#11933)
  [formrecognizer] update formrecognizer links to new aka.ms naming (Azure#12079)
  changes in samples tests (Azure#12090)
  readme & sample updates (Azure#12095)
  Update Key Vault minimum azure-core to 1.4.0 (Azure#12074)
  [formrecognizer] test parity with other languages (Azure#12059)
  syncing missing changelog items (Azure#12089)
  updating doc references (Azure#12086)
  ...
  • Loading branch information
iscai-msft committed Jun 22, 2020
2 parents 42d3eb2 + 4fef4d7 commit 0977b6e
Show file tree
Hide file tree
Showing 625 changed files with 12,655 additions and 5,676 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/sdk/containerinstance/ @samkreter @xizhamsft
/sdk/containerregistry/ @djyou
/sdk/containerservice/ @samkreter @zqingqing1 @GaneshaThirumurthi
/sdk/cosmos/ @shurd
/sdk/cosmos/ @southpolesteve @zfoster
/sdk/datafactory/ @hvermis
/sdk/datalake/ @ro-joowan
/sdk/datadatamigration/ @vchske
Expand Down
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_bash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug Bash report
about: Create a report about bug bash
title: "[BUG Bash]"
labels: bugbash, Mgmt
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

***Exception or Stack Trace***
Add the exception log and stack trace if available

**To Reproduce**
Steps to reproduce the behavior:

***Code Snippet***
Add the code snippet that causes the issue.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Setup (please complete the following information):**
- Python Version: [e.g. Python 3.8]
- SDK Version: [e.g. azure-mgmt-resource-15.0.0b1]

**Additional context**
Add any other context about the problem here.

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [ ] Bug Description Added
- [ ] Repro Steps Added
- [ ] Setup information Added
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The client libraries are supported on Python 2.7 and 3.5.3 or later.
Each service might have a number of libraries available from each of the following categories:
* [Client - New Releases](#Client-New-Releases)
* [Client - Previous Versions](#Client-Previous-Versions)
* [Management](#Management)
* [Management - New Releases](#Management-New-Releases)
* [Management - Previous Versions](#Management-Previous-Versions)

### Client: New Releases

Expand All @@ -33,9 +34,15 @@ You can find the [most up to date list of all of the new packages on our page](h

Last stable versions of packages that have been provided for usage with Azure and are production-ready. These libraries provide you with similar functionalities to the Preview ones as they allow you to use and consume existing resources and interact with them, for example: upload a blob. They might not implement the [guidelines](https://azure.github.io/azure-sdk/python_introduction.html) or have the same feature set as the Novemeber releases. They do however offer wider coverage of services.

### Management
### Management: New Releases
A new set of management libraries that follow the [Azure SDK Design Guidelines for Python](https://azure.github.io/azure-sdk/python/guidelines/) are now in Public Preview. These new libraries provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.
You can find the list of new packages [on this page](https://azure.github.io/azure-sdk/releases/latest/python.html). Documentation and for these new libraries can be found [here](https://azure.github.io/azure-sdk-for-python). Code samples can also be viewed [here](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing)

Libraries which enable you to provision specific resources. They are responsible for directly mirroring and consuming Azure service's REST endpoints. The management libraries use the `azure-mgmt-<service name>` convention for their package names.
> NOTE: If you need to ensure your code is ready for production use one of the stable, non-preview libraries.
### Management: Previous Versions
For a complete list of management libraries which enable you to provision and manage Azure resources, please check [here](https://azure.github.io/azure-sdk/releases/latest/all/python.html). They might not have the same feature set as the new releases but they do offer wider coverage of services.
Management libraries can be identified by namespaces that start with `azure-mgmt-`, e.g. `azure-mgmt-compute`

## Need help?

Expand Down
1 change: 1 addition & 0 deletions doc/sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ section of the project.

installation
quickstart_authentication
mgmt_preview_quickstart
multicloud
exceptions
Service Management (Legacy) <servicemanagement>
Expand Down
267 changes: 267 additions & 0 deletions doc/sphinx/mgmt_preview_quickstart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
Quickstart Tutorial - Resource Management (Preview Libraries)
===============================================================

We are excited to announce that a new set of management libraries are now in Public Preview.
Those packages share a number of new features such as Azure Identity support,
HTTP pipeline, error-handling.,etc, and they also follow the new Azure SDK guidelines which
create easy-to-use APIs that are idiomatic, compatible, and dependable.

You can find the details of those new libraries `here <https://azure.github.io/azure-sdk/releases/latest/#python>`__

In this basic quickstart guide, we will walk you through how to
authenticate to Azure using the preview libraries and start interacting with
Azure resources. There are several possible approaches to
authentication. This document illustrates the most common scenario

Prerequisites
-------------

| You will need the following values to authenticate to Azure
- **Subscription ID**
- **Client ID**
- **Client Secret**
- **Tenant ID**

These values can be obtained from the portal, here's the instructions:

Get Subscription ID
^^^^^^^^^^^^^^^^^^^

1. Login into your Azure account
2. Select Subscriptions in the left sidebar
3. Select whichever subscription is needed
4. Click on Overview
5. Copy the Subscription ID

Get Client ID / Client Secret / Tenant ID
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For information on how to get Client ID, Client Secret, and Tenant ID, please refer to `this document <https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal>`__

Setting Environment Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After you obtained the values, you need to set the following values as
your environment variables

- ``AZURE_CLIENT_ID``
- ``AZURE_CLIENT_SECRET``
- ``AZURE_TENANT_ID``
- ``AZURE_SUBSCRIPTION_ID``

To set the following environment variables on your development system:

Windows (Note: Administrator access is required)

1. Open the Control Panel
2. Click System Security, then System
3. Click Advanced system settings on the left
4. Inside the System Properties window, click the Environment Variables… button.
5. Click on the property you would like to change, then click the Edit… button. If the property name is not listed, then click the New… button.

Linux-based OS
::

export AZURE_CLIENT_ID="__CLIENT_ID__"
export AZURE_CLIENT_SECRET="__CLIENT_SECRET__"
export AZURE_TENANT_ID="__TENANT_ID__"
export AZURE_SUBSCRIPTION_ID="__SUBSCRIPTION_ID__"

Authentication and Creating Management Client
------------------------------------------------------

Now that the environment is setup, all you need to do is to create an
authenticated client. Our default option is to use
**DefaultAzureCredential** and in this guide we have picked
**Resources** as our target service, but you can set it up similarly for any other service that you are using.

To authenticate to Azure and create
a management client, simply do the following:

::

import azure.mgmt.resource
import azure.mgmt.network
from azure.identity import DefaultAzureCredential
...
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID")
credential = DefaultAzureCredential()
resource_client = azure.mgmt.resource.ResourceManagementClient(credential=credential, subscription_id=subscription_id)
network_client = azure.mgmt.network.NetworkManagementClient(credential=credential, subscription_id=subscription_id)

More information and different authentication approaches using Azure Identity can be found in
`this document <https://docs.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python>`__

Managing Resources
------------------

Now that we are authenticated, we can use the Resource client (azure.mgmt.resource.ResourceManagementClient) we have created to perform operations on Resource Group. In this example, we will show to manage Resource Groups.

**Create a resource group**

::

location = "westus2"
group_name = "my_resource_group_name"
group = resource_client.resource_groups.create_or_update(
group_name,
{'location': location}
)

**Update a resource group**

::

group_name = "my_resource_group_name"
group.tags = {
"environment":"test",
"department":"tech"
}
updated_group = resource_client.resource_groups.create_or_update(group_name, group)

**List all resource groups**

::

group_list = self.resource_client.resource_groups.list()
for g in group_list:
print_resource_group(g)

**Delete a resource group**

::

delete_async_op = resource_client.resource_groups.begin_delete(group_name)
delete_async_op.wait()

Managing Network
------------------
We can use the Network client (azure.mgmt.resource.NetworkManagementClient) we have created to perform operations on Network related resources. In this example, we will show how to manage Public IP Addresses.

**Create a Network Public IP Address**

::

GROUP_NAME = "testgroup"
PUBLIC_IP_ADDRESS = "public_ip_address_name"

# Create Resource Group
resource_client.resource_groups.create_or_update(
GROUP_NAME,
{"location": "eastus"}
)

# Create Public IP Address
public_ip_address = network_client.public_ip_addresses.begin_create_or_update(
GROUP_NAME,
PUBLIC_IP_ADDRESS,
{
"location": "eastus"
}
).result()
print("Create Public IP Address:\n{}".format(public_ip_address))

**Get a Network Public IP Address**

::

public_ip_address = network_client.public_ip_addresses.get(
GROUP_NAME,
PUBLIC_IP_ADDRESS
)
print("Get Public IP Address:\n{}".format(public_ip_address))

**Update tags in Network Public IP Address**

::

# Update Public IP Address
public_ip_address = network_client.public_ip_addresses.update_tags(
GROUP_NAME,
PUBLIC_IP_ADDRESS,
{
"tags": {
"tag1": "value1",
"tag2": "value2"
}
}
)
print("Updated Public IP Address \n{}".format(public_ip_address))

**Delete a Network Public IP Address**

::

# Delete Public IP Address
public_ip_address = network_client.public_ip_addresses.begin_delete(
GROUP_NAME,
PUBLIC_IP_ADDRESS
).result()
print("Delete Public IP Address.\n")

Async and sync operations
-------------------------
In python>=3.5, Azure Python SDK provides the choice for user to use the asynchronous client for asynchronous programming.

Note that asyncio in Windows is underpowered and please take caution when using async operations on Windows systems

**Create Async Management Client**
::

from azure.identity.aio import DefaultAzureCredential
from azure.mgmt.network.aio import NetworkManagementClient
from azure.mgmt.resource.resources.aio import ResourceManagementClient

SUBSCRIPTION_ID = os.environ.get("SUBSCRIPTION_ID", None)
credential = DefaultAzureCredential()
resource_client = ResourceManagementClient(
credential=credential,
subscription_id=SUBSCRIPTION_ID
)
network_client = NetworkManagementClient(
credential=credential,
subscription_id=SUBSCRIPTION_ID
)

**Create a Network Public IP Address Async**
::

GROUP_NAME = "testgroup"
PUBLIC_IP_ADDRESS = "public_ip_address_name"

# Create Resource Group
await resource_client.resource_groups.create_or_update(
GROUP_NAME,
{"location": "eastus"}
)

# Create Public IP Address
async_poller = await network_client.public_ip_addresses.begin_create_or_update(
GROUP_NAME,
PUBLIC_IP_ADDRESS,
{
"location": "eastus"
}
)
public_ip_address = await async_poller.result()
print("Create Public IP Address:\n{}".format(public_ip_address))
Code Samples
-------------------------
For more code samples, please see `here <https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing>`__

Need help?
----------
- File an issue via `Github Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__ and make sure you add the "Preview" label to the issue
- Check `previous questions <https://stackoverflow.com/questions/tagged/azure+python>`__ or ask new ones on StackOverflow using azure and python tags.

Contributing
------------
For details on contributing to this repository, see the contributing guide.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
10 changes: 0 additions & 10 deletions eng/pipelines/aggregate-reports.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
resources:
repositories:
- repository: azure-sdk-tools
type: github
name: Azure/azure-sdk-tools
endpoint: azure
- repository: azure-sdk-build-tools
type: git
name: internal/azure-sdk-build-tools

trigger: none
pr: none

Expand Down
9 changes: 1 addition & 8 deletions eng/pipelines/create-doc-index.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
trigger: none

resources:
repositories:
- repository: azure-sdk-tools
type: github
name: Azure/azure-sdk-tools
endpoint: azure

variables:
PythonVersion: '3.6'

Expand All @@ -27,7 +20,7 @@ jobs:
inputs:
versionSpec: $(PythonVersion)

- template: eng/pipelines/templates/scripts/replace-relative-links.yml@azure-sdk-tools
- template: /eng/common/pipelines/templates/steps/replace-relative-links.yml
parameters:
TargetFolder: '.'
RootFolder: '.'
Expand Down

0 comments on commit 0977b6e

Please sign in to comment.