getting proper api version for azure python delete_by_id method

  • Last Update :
  • Techknowledgy :

When using some api versions (e.g. 2018-05-01) I get error for some of resource types:

Azure Error: NoRegisteredProviderFound
Message: No registered resource provider found
for location 'westeurope'
and API version '['
2018 - 05 - 01 ']'
for type 'virtualMachines'.The supported api - versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-08-30, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01'.The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth'.
ERROR: 'CloudError'
object has no attribute '__traceback__'

Suggestion : 2

Get this mapping would be a list anycodings_azure providers call.,If I am not mistaken, anycodings_azure resources.delete_by_id is a wrapper over anycodings_azure Delete By Id REST API method. Currently anycodings_azure the latest API Version for this anycodings_azure operation is 2018-05-01. You can use anycodings_azure that in your method call.,How can I determine which API version should anycodings_api be passed to the method? I've tried to find anycodings_api something in docs and code of SDK, but I anycodings_api couldn't come up with a proper solution.,When using some api versions (e.g. anycodings_api 2018-05-01) I get error for some of resource anycodings_api types:

When using some api versions (e.g. anycodings_api 2018-05-01) I get error for some of resource anycodings_api types:

Azure Error: NoRegisteredProviderFound
Message: No registered resource provider found
for location 'westeurope'
and API version '['
2018 - 05 - 01 ']'
for type 'virtualMachines'.The supported api - versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-08-30, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01'.The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth'.
ERROR: 'CloudError'
object has no attribute '__traceback__'

Suggestion : 3

I'm working on automated deletion of Azure resources based on tags attached to these resources., Azure SDK API Design Your API surface will consist of one or more service clients that the consumer will instantiate to connect to your service, plus a set of supporting types. , 2 days ago Apr 01, 2021  · To keep the solution up to date you want to identify when resources are released in a new API version. E.g. the initial deployment used this resource/API: I'd like to identify … ,I'm using Azure SDK for python (https://github.com/Azure/azure-sdk-for-python) - I found how to get a list of my resources and that I can delete them with ResourceManagementClient with resources.delete_by_id method. However, this method requires 2 arguments - resource id (which I have from resources listed by ResourceManagementClient) and API version (which is different for every resource type.


Azure Error: NoRegisteredProviderFound Message: No registered resource provider found
for location 'westeurope'
and API version '['
2018 - 05 - 01 ']'
for type 'virtualMachines'.The supported api - versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-08-30, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01'.The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth'.ERROR: 'CloudError'
object has no attribute '__traceback__'
Azure Error: NoRegisteredProviderFound Message: No registered resource provider found
for location 'westeurope'
and API version '['
2018 - 05 - 01 ']'
for type 'virtualMachines'.The supported api - versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-08-30, 2017-03-30, 2017-12-01, 2018-04-01, 2018-06-01, 2018-10-01, 2019-03-01'.The supported locations are 'eastus, eastus2, westus, centralus, northcentralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, brazilsouth, southindia, centralindia, westindia, canadacentral, canadaeast, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, southafricanorth'.ERROR: 'CloudError'
object has no attribute '__traceback__'

Suggestion : 4

04/04/2022

Sample JSON:

{
   "galleryEndpoint": "https://portal.local.azurestack.external:30015/",
   "graphEndpoint": "https://graph.windows.net/",
   "portal Endpoint": "https://portal.local.azurestack.external/",
   "authentication": {
      "loginEndpoint": "https://login.windows.net/",
      "audiences": ["https://management.yourtenant.onmicrosoft.com/3cc5febd-e4b7-4a85-a2ed-1d730e2f5928"]
   }
}

Find the Python certificate store location on your machine. The location may vary, depending on where you installed Python. Open a command prompt or an elevated PowerShell prompt, and type the following command:

  python - c "import certifi; print(certifi.where())"

Trust the Azure Stack Hub CA root certificate by appending it to the existing Python certificate:

$pemFile = "<Fully qualified path to the PEM certificate; for ex: C:\Users\user1\Downloads\root.pem>"

$root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$root.Import($pemFile)

Write-Host "Extracting required information from the cert file"
$md5Hash    = (Get-FileHash -Path $pemFile -Algorithm MD5).Hash.ToLower()
$sha1Hash   = (Get-FileHash -Path $pemFile -Algorithm SHA1).Hash.ToLower()
$sha256Hash = (Get-FileHash -Path $pemFile -Algorithm SHA256).Hash.ToLower()

$issuerEntry  = [string]::Format("# Issuer: {0}", $root.Issuer)
$subjectEntry = [string]::Format("# Subject: {0}", $root.Subject)
$labelEntry   = [string]::Format("# Label: {0}", $root.Subject.Split('=')[-1])
$serialEntry  = [string]::Format("# Serial: {0}", $root.GetSerialNumberString().ToLower())
$md5Entry     = [string]::Format("# MD5 Fingerprint: {0}", $md5Hash)
$sha1Entry    = [string]::Format("# SHA1 Fingerprint: {0}", $sha1Hash)
$sha256Entry  = [string]::Format("# SHA256 Fingerprint: {0}", $sha256Hash)
$certText = (Get-Content -Path $pemFile -Raw).ToString().Replace("`r`n","`n")

$rootCertEntry = "`n" + $issuerEntry + "`n" + $subjectEntry + "`n" + $labelEntry + "`n" + `
$serialEntry + "`n" + $md5Entry + "`n" + $sha1Entry + "`n" + $sha256Entry + "`n" + $certText

Write-Host "Adding the certificate content to Python Cert store"
Add-Content "${env:ProgramFiles(x86)}\Python35\Lib\site-packages\certifi\cacert.pem" $rootCertEntry

Write-Host "Python Cert store was updated to allow the Azure Stack Hub CA root certificate"

Find the Python certificate store location on your machine. The location may vary, depending on where you installed Python. Open a command prompt or an elevated PowerShell prompt, and type the following command:

  python - c "import certifi; print(certifi.where())"

Trust the Azure Stack Hub CA root certificate by appending it to the existing Python certificate:

$pemFile = "<Fully qualified path to the PEM certificate; for ex: C:\Users\user1\Downloads\root.pem>"

$root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$root.Import($pemFile)

Write-Host "Extracting required information from the cert file"
$md5Hash    = (Get-FileHash -Path $pemFile -Algorithm MD5).Hash.ToLower()
$sha1Hash   = (Get-FileHash -Path $pemFile -Algorithm SHA1).Hash.ToLower()
$sha256Hash = (Get-FileHash -Path $pemFile -Algorithm SHA256).Hash.ToLower()

$issuerEntry  = [string]::Format("# Issuer: {0}", $root.Issuer)
$subjectEntry = [string]::Format("# Subject: {0}", $root.Subject)
$labelEntry   = [string]::Format("# Label: {0}", $root.Subject.Split('=')[-1])
$serialEntry  = [string]::Format("# Serial: {0}", $root.GetSerialNumberString().ToLower())
$md5Entry     = [string]::Format("# MD5 Fingerprint: {0}", $md5Hash)
$sha1Entry    = [string]::Format("# SHA1 Fingerprint: {0}", $sha1Hash)
$sha256Entry  = [string]::Format("# SHA256 Fingerprint: {0}", $sha256Hash)
$certText = (Get-Content -Path $pemFile -Raw).ToString().Replace("`r`n","`n")

$rootCertEntry = "`n" + $issuerEntry + "`n" + $subjectEntry + "`n" + $labelEntry + "`n" + `
$serialEntry + "`n" + $md5Entry + "`n" + $sha1Entry + "`n" + $sha256Entry + "`n" + $certText

Write-Host "Adding the certificate content to Python Cert store"
Add-Content "${env:ProgramFiles(x86)}\Python35\Lib\site-packages\certifi\cacert.pem" $rootCertEntry

Write-Host "Python Cert store was updated to allow the Azure Stack Hub CA root certificate"

Suggestion : 5

✔️ YOU MAY include all service API versions that are supported by the client library in a ServiceVersion enumerated value.,Your API surface will consist of one or more service clients that the consumer will instantiate to connect to your service, plus a set of supporting types.,✅ DO support 100% of the features provided by the Azure service the client library represents. Gaps in functionality cause confusion and frustration among developers.,✅ DO qualify a service parameter name if it conflicts with any of the documented pipeline policy or transport configuration options used with all service operations and client constructors.

# Yes
class CosmosClient(object)...

   # No
class CosmosProxy(object)...

   # No
class CosmosUrl(object)...
# Change
default number of retries to 18 and overall timeout to 2 s.
client = ExampleClient('https://contoso.com/xmpl',
   DefaultAzureCredential(),
   max_retries = 18,
   timeout = 2)
class ExampleClientWithConnectionString(object):

   @classmethod
def _parse_connection_string(cls, connection_string): ...

   @classmethod
def from_connection_string(cls, connection_string, ** kwargs):
   endpoint, credential = cls._parse_connection_string(connection_string)
return cls(endpoint, credential, ** kwargs)
from azure.identity
import DefaultAzureCredential

# By
default, use the latest supported API version
latest_known_version_client = ExampleClient('https://contoso.com/xmpl',
   DefaultAzureCredential())

#...but allow the caller to specify a specific API version as welll
specific_api_version_client = ExampleClient('https://contoso.com/xmpl',
   DefaultAzureCredential(),
   api_version = '1971-11-01')
client = ComputeClient(...)

try:
# Please note that there is no status code etc.as part of the response.
# If the call fails, you will get an exception that will include the status code
#(
   if the request was made)
virtual_machine = client.get_virtual_machine('example')
print(f 'Virtual machine instance looks like this: {virtual_machine}')
except azure.core.exceptions.ServiceRequestError as e:
   print(f 'Failed to make the request - feel free to retry. But the specifics are here: {e}')
except azure.core.exceptions.ServiceResponseError as e:
   print(f 'The request was made, but the service responded with an error. Status code: {e.status_code}')