Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

StorageManagementClient.blobServices is missing in azure-arm-storage #4655

Closed
amclin opened this issue Feb 8, 2019 · 4 comments
Closed

StorageManagementClient.blobServices is missing in azure-arm-storage #4655

amclin opened this issue Feb 8, 2019 · 4 comments
Assignees

Comments

@amclin
Copy link

amclin commented Feb 8, 2019

According to the docs, blobServices is supposed to be a property on the StorageManagementClient:
https://docs.microsoft.com/en-us/javascript/api/azure-arm-storage/storagemanagementclient?view=azure-node-latest

However, when initializing a StorageManagementClient, blobServices is undefined.
screen shot 2019-02-07 at 5 04 38 pm 2

Without this, it's impossible to manage blobServices properties

Example code

const msRestAzure = require('ms-rest-azure')
const { StorageManagementClient } = require('@azure/arm-storage')

const clientId = process.env.CLIENT_ID
const tenantId = process.env.TENANT_ID
const secret = process.env.APPLICATION_SECRET
const subscriptionId = process.env.AZURE_SUBSCRIPTION_ID

msRestAzure.loginWithServicePrincipalSecret(clientId, secret, tenantId)
  .then((credentials) => {
    const client = new StorageManagementClient(credentials, subscriptionId)
    return Promise.resolve(client)
  })
  .then((client) => {
    console.log(client.blobServices)
  })
  .catch((err) => {
    console.error(err)
  })
@amclin
Copy link
Author

amclin commented Feb 25, 2019

This appears to be due to this project using an old version of arm-storage-manager:
https://github.com/Azure/azure-sdk-for-node/blob/master/package.json#L89

Current version is 7.0.0:
https://www.npmjs.com/package/azure-arm-storage

I can confirm that the 7.0.0 version contains the blobServices property
screen shot 2019-02-25 at 1 52 47 pm

@kpajdzik
Copy link
Contributor

kpajdzik commented Mar 8, 2019

@amclin, I don't believe that's the issue. The version specified in package.json was used to build an Azure SDK for Node.js package which included all the SDKs at the same time. This is not released anymore.

The issue may have different root cause. I see you're using new TypeScript SDK (@azure/arm-storage) mixed with old Node.js SDK (ms-rest-azure). Please see https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/Migration.md and ask me or @daschult if you have more questions. Please reopen the issue if the new package won't resolve it.

@amclin
Copy link
Author

amclin commented Mar 13, 2019

@kpajdzik between the NPM package entries, the readmes in the root of the various github repos, and the docs.microsoft.com, it is impossible to tell what the authoritative/recommended "latest" packages are. The example implementations in provided documentation are inconsistent.

All three modules listed in NPM give you different implementation versions:

  • npm install azure => azure-arm-storage 5.0.0
  • npm install azure-arm-storage => azure-arm-storage 7.0.0
  • npm install @azure/arm-storage => @azure/arm-storage 7.0.1

@kpajdzik
Copy link
Contributor

@amclin, I understand the confusion, we're working on clarifying that but it takes some time to update all the readmes. The updated readme looks like this - https://www.npmjs.com/package/azure-arm-eventgrid - if you feel like this can be improved let me know. I'll try to update storage package as soon as possible.

I wasn't aware that "azure" package is not marked as deprecated. I will work on that. Thanks for bringing this to my attention.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants