GithubHelp home page GithubHelp logo

azure-samples / azure-samples-python-management Goto Github PK

View Code? Open in Web Editor NEW
146.0 24.0 130.0 481 KB

This repo contains sample code for management libraries of Azure SDK for Python

License: MIT License

Shell 0.64% Python 99.36%
hacktoberfest azure-sdk

azure-samples-python-management's People

Contributors

00kai0 avatar ajpeacock0 avatar andrsmith149 avatar bigcat20196 avatar cburuzie avatar chentanyi avatar chenxijiang333 avatar dependabot[bot] avatar hibohra98 avatar jassingh819 avatar jujiang-msft avatar kazrael2119 avatar leigharubin avatar microsoft-github-operations[bot] avatar microsoftopensource avatar msyyc avatar nickzhums avatar niveditjain avatar ray-316 avatar rogerbestmsft avatar srebuilt avatar v-xuto avatar venkatr21 avatar wzb123456789 avatar zhoxing-ms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-samples-python-management's Issues

How to add networking parameters when creating azure container group & instance.

I'm able to create to create the container group and the container runs fine, but I wanted to know how to add networking parameters to the following lines so that the container can be accessed publicly.

container_group = containerinstance_client.container_groups.begin_create_or_update(
GROUP_NAME,
CONTAINER_GROUP,
{
"location": "eastus",
"identity": {
"type": "SystemAssigned"
},
"containers": [
{
"name": CONTAINER_NAME,
"command": [],
"environment_variables": [],
"image": "nginx",
"ports": [
{
"port": "80"
}
],
"resources": {
"requests": {
"cpu": "1",
"memory_in_gb": "1.5",
"gpu": {
"count": "1",
"sku": "K80"
}
}
},
"volume_mounts": [
{

For reference, I'm trying to create a publicly accessible container instance with networking properties similar to the ones here:
Screenshot (38)

I wan to be able to put there parameters into the code so that using python, I can create the container instance with desired networking configurations. Please, I need to do this urgently, any help would be appreciated.

appservice/manage_app_service_plan use of SkuDescription can be simplified

"sku": {
"name": "P1",
"tier": "Premium",
"size": "P1",
"family": "P",
"capacity": "1"
}

In testing I found the only property the server interprets is the "name" and all the others are ignored. For example you can ask for a name "F1", tier "Premium", size "B1" and you get an F1.

Related documentation issue: Azure/azure-sdk-for-python#16251

Recommendation to use REST API in Python

With the necessity of installing multiple dependencies and then the overhead of managing and updating them, utilizing the REST API instead of the Python SDK has been easier. There are no dependencies as requests is bulit-in and there's no updates required. While I think the Python SDK is still necessary, I wanted to provide this perspective for developers to just use requests and make the REST API call is also a good solution.

It also looks like the samples have the sample JSON data structures that the REST API expects too.

Documentation for azure-mgmt-synapse

I'm trying to integrate an existing account with the Overture API using Microsoft Synapse SQL queries. I haven't encountered much documentation in doing so.

Specifically I was wondering if it was possible through this python library to:

  1. Push SQL commands and publish them to Synapse Studio programatically
  2. Execute those commands through Python and download the results.

Is this possible and is azure-mgmt-synapse the appropriate library for achieving this? If so where can I best find documentation for this?

Failed to establish a new connection: [Errno 11001] getaddrinfo failed

When I create the CostManagementClient object, there is nothing wrong, but when I use the CostManagementClient object to send a request, the error occurred.

How can I handle the exception Error?

'''
azure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x00000276CD390490>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
'''

Recovery Services Backup Missing

There's a good example for the Recovery Services module, but none for the much larger, more complex Recovery Services Backup module. It would be very useful to see a script that creates a Policy, attaches a vm to it, backs up that vm, and restores that vm from a backup.

Use of route_tables.begin_create_or_update yields removal of all routes and adds new entry

using the sdk for creating vnets and subnets in azure, and when adding a new route table entry, the new route table entry removed all existsing routes and added the new route to the route table.

The expected behavior would be to add another entry to the route table, rather than replace the route table contents with a single entry.

here is the sample code...

        routeTableResponse = network_client.route_tables.begin_create_or_update(
        resource_group_name=rgname,
        route_table_name=rtname,
        parameters={
          "location": region,
          "properties": {
            "disableBgpRoutePropagation": False, 
            "routes": [
              {
                "name": newvnetname,
                "properties": { 
                    "addressPrefix": newvnetprefix, 
                    "nextHopType": "VirtualAppliance", 
                    "nextHopIpAddress": hublbipaddress} 
              }
            ],
          }
        }
    ).result()

How can I detach a Public IP from Interface ?

From the samples I can only know how to create_or_update a Public IP/Interface or just delete it (if I try to delete an attached IP, there will be an exception and ask me to detach the Public IP from Interface first).
So how can I detach a Public IP from Interface ?

Not able to get partition_id in cosmosdb

Hi,
I am using CollectionPartitionOperations -> list_metrics.

metrics = client.collection_partition.list_metrics(
        resource_group,
        account_name,
        database_rid,
        container_rid,
        "(name.value eq 'Data Size') and timeGrain eq duration'P1D' and startTime eq '2023-01-01T13:53:55.2780000Z' and endTime eq '2023-01-31T15:58:55.2780000Z'"
    )

for metric in metrics:
        print(metric)

Not printing anything.

I set 80,000 throughputs in my container.

We are using:
Python Azure SDK - azure-mgmt-cosmosdb==6.4.0
The document we follow:
https://learn.microsoft.com/en-us/python/api/azure-mgmt-cosmosdb/azure.mgmt.cosmosdb.operations.collectionpartitionoperations?view=azure-python

broken import due to renamed MonitorClient to MonitorManagementClient

wrong import seen in manage_activity_log_alert.py

probably there are more broken imports due to refactoring going on and probable all samples should be re-validated for broken imports..

correct are:
[..]
from azure.mgmt.monitor import MonitorManagementClient
[..]
monitor_client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id=SUBSCRIPTION_ID
)

azure quota sdk doesn't print/return anything

Using example from:

https://github.com/Azure-Samples/azure-samples-python-management/blob/main/samples/quota/mamge_create_or_update.py

When a request is made, it completes without printing the response, thus we are having to check if it was successful by running a new query to check the current quota limit to see if it has increased. This sample provided is very bare, and non-functional. Increased documentation / examples on the quota lib would be very helpful.

Sample for changing CA certificate on IotHub

Hello,

I've been struggling finding some samples that will allows me to change/add CA certificate to my IotHub instance. Is there any sample available ?

Here what I began to do, but it doesn't work...

new_cert_pem: str = "---BEGIN CERTIFICATE----aaag..." # PEM format
environ['AZURE_CLIENT_ID'] = ""
environ['AZURE_TENANT_ID'] = ""
environ['AZURE_CLIENT_SECRET'] = ""
iothub_client = IotHubClient(
   credential=DefaultAzureCredential(),
   subscription_id=environ['AZ_SUBCRIPTION_ID']
)
iothub_client.certificates.create_or_update(
   resource_group_name="iothub",
   resource_name="myiothub",
   certificate_name="CA-TO-ADD"
   certificate_description=CertificateBodyDescription(
       certificate=new_cert_pem.decode('utf8'),
       is_verified=True
   )
)

Thanks for your help !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.