Files
2025-03-07 19:22:02 +01:00

68 lines
3.0 KiB
JavaScript

/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { __awaiter } from "tslib";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageManagementClient } from "@azure/arm-storage";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Create or update the properties of a local user associated with the storage account
*
* @summary Create or update the properties of a local user associated with the storage account
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/LocalUserCreate.json
*/
function createLocalUser() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res6977";
const accountName = "sto2527";
const username = "user1";
const properties = {
hasSshPassword: true,
homeDirectory: "homedirectory",
permissionScopes: [
{ permissions: "rwd", resourceName: "share1", service: "file" },
{ permissions: "rw", resourceName: "share2", service: "file" }
],
sshAuthorizedKeys: [
{ description: "key name", key: "ssh-rsa keykeykeykeykey=" }
]
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.localUsersOperations.createOrUpdate(resourceGroupName, accountName, username, properties);
console.log(result);
});
}
createLocalUser().catch(console.error);
/**
* This sample demonstrates how to Create or update the properties of a local user associated with the storage account
*
* @summary Create or update the properties of a local user associated with the storage account
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-09-01/examples/LocalUserUpdate.json
*/
function updateLocalUser() {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "res6977";
const accountName = "sto2527";
const username = "user1";
const properties = {
hasSharedKey: false,
hasSshKey: false,
hasSshPassword: false,
homeDirectory: "homedirectory2"
};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = yield client.localUsersOperations.createOrUpdate(resourceGroupName, accountName, username, properties);
console.log(result);
});
}
updateLocalUser().catch(console.error);
//# sourceMappingURL=localUsersCreateOrUpdateSample.js.map