MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.01k stars 21k forks source link

ModuleNotFoundError: No module named 'azure.profiles' #122237

Open SongYouk opened 1 week ago

SongYouk commented 1 week ago

[Enter feedback here] Dear azure support team, could you check again really this page works?

I have installed all the packages' whl files as attached.

image

And I followrf all the process as described, and I remember that about two months ago I could get success from the same page, but today(May 5th, 2024), continuously get the error as "ModuleNotFoundError: No module named 'azure.profiles'"

So could you review and clarify again?

with best regards,


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

TPavanBalaji commented 1 week ago

@SongYouk Thanks for your feedback! We will investigate and update as appropriate.

SongYouk commented 1 week ago

@TPavanBalaji The solution is very simple. I solved now. But I would like to recommend two things to be updated in the page.

  1. Not any more possible to add new pacakges into the environment which azure maintains. The information is given as below in the sublink from the page. image

But not any more possible to add new packages from the given environment. So should create new environment by myself as below. image

  1. In the page 6 packages are listed. But should install "azure-common" as well Listed

image

The below is my script in runbook to start VM. And I used Service Principal rather than using 'azure_credential = DefaultAzureCredential()'

#!/usr/bin/env Python38new
# Example function to uninstall packages before reinstalling
import subprocess
import sys
import os

def upgrade_pip():
    subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])

from azure.identity import ClientSecretCredential
from azure.mgmt.compute import ComputeManagementClient

credential = ClientSecretCredential(
    tenant_id='Your Tenant ID',
    client_id='Your Client ID',
    client_secret='Your Client Secret'
)

compute_client = ComputeManagementClient(credential, 'Your Subscription ID')

# Get resource group and VM name from command-line arguments

resource_group_name = "vm-tws_group"
vm_name = "vm-tws"

# Start the VM
print('\nStarting VM...')
async_vm_start = compute_client.virtual_machines.begin_start(resource_group_name, vm_name)
async_vm_start.wait()
print('\nVM started successfully.')

with best regards,