This message was deleted.
# general
s
This message was deleted.
t
This issue should help you avoid this immediate error: https://github.com/pulumi/pulumi/issues/4164
s
@tall-librarian-49374 Thanks for the reply! I tried the code and this code currently gives an error:
Copy code
var resourceGroup = new ResourceGroup("ppwe-playground-pulumi-dev",null, new CustomResourceOptions
{
    ImportId = "ppwe-playground-pulumi-dev" 
});
(my IDE doesn't recognize 'CustomResourceOptions')
t
Weird... It's in Pulumi namespace.
s
Copy code
const resourceGroup = new azure.core.ResourceGroup("name", null, new pulumi.CustomResourceOptions {
    ImportId = "";
});
@tall-librarian-49374 ^ also doesn't work. Was there any update in the past week? Is there a fix for this?
t
Oh, based on your previous snippet I thought you are in C#… This should work in TypeScript:
Copy code
const resourceGroup = new azure.core.ResourceGroup("name", {}, {
    importId: "",
});
(edited my code). I’m confused about the language you are using…
s
@tall-librarian-49374 NodeJS, Javascript.
t
Okay, try my last snippet then.
s
Still doesn't work.
Copy code
"use strict";
const pulumi = require("@pulumi/pulumi");
const azure = require("@pulumi/azure");

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("kynda_crud", {}, {
    importId: "cc7bdc8c-aff8-4c6b-81ca-154b2e02e859",
});

// Create an Azure resource (Storage Account)
const account = new azure.storage.Account("pulumi-storage", {
    // The location for the storage account will be derived automatically from the resource group.
    resourceGroupName: resourceGroup.name,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});

// Export the connection string for the storage account
return exports.connectionString = account.primaryConnectionString;
c
I assume you ran "npm install"?
s
@colossal-room-15708 Yes, I also installed the full Pulumi packages globally.
Still getting the following error:
Copy code
azure:storage:Account (pulumi-storage):
error: Error reading resource group: resources.GroupsClient#Get: Failure responding to request: StatusCode=403 -- Orig<m action 'Microsoft.Resources/subscriptions/resourcegroups/read' over scope '/subscriptions/<subscription id>/resourcegroups/kynda_crud3e6161db' or
the scope is invalid. If access was recently granted, please refresh your credentials."
@colossal-room-15708 @tall-librarian-49374 is there a fix for this error?
c
did you create that resource group or someone else?
it seems like whatever account you're using to log in to azure does not have permissions to that resource group
s
I created the resource group
and was able to call Cosmos DB in a previous project without Pulumi
@colossal-room-15708 Is there maybe an option to use a custom endpoint url and key? Ex for Cosmos DB:
Copy code
{
  "endpoint": "<https://resource-account.documents.azure.com:443/>",
  "key": "Key",
  "databaseId": "Database_Id",
  "containerId": "items"
}
c
Are you still trying to get the example script working that you pasted in above? This looks very much like a permissions issue on the resource group, not with the pulumi code.
does this happen when you run
pulumi preview
?
s
@colossal-room-15708 Yes, I'm still trying to let Azure work with the example script. Sadly it does the same on
pulumi preview