Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom role definitions for MHSM #11465

Merged
merged 3 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"scope": "",
"api-version": "7.2-preview",
"roleDefinitionName": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"properties": {
"roleName": "My custom role",
"type": "CustomRole",
"description": "Role description",
"assignableScopes": [
"/"
],
"permissions": [
{
"dataActions": [ "Microsoft.KeyVault/managedHsm/keys/sign/action" ],
}
]
},
"id": "Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/00000000-0000-0000-0000-000000000000",
"type": "Microsoft.Authorization/roleDefinitions",
"name": "00000000-0000-0000-0000-000000000000"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"scope": "",
"api-version": "7.2-preview",
"roleDefinitionName": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"properties": {
"roleName": "My custom role",
"type": "CustomRole",
"description": "Role description",
"assignableScopes": [
"/"
],
"permissions": [
{
"dataActions": [ "Microsoft.KeyVault/managedHsm/keys/sign/action" ],
}
]
},
"id": "Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/00000000-0000-0000-0000-000000000000",
"type": "Microsoft.Authorization/roleDefinitions",
"name": "00000000-0000-0000-0000-000000000000"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"scope": "keys",
"roleDefinitionName": "00000000-0000-0000-0000-000000000000",
"parameters": {
"properties": {
"roleName": "My custom role",
"type": "CustomRole",
"description": "Role description",
"permissions": [
{
"dataActions": [ "Microsoft.KeyVault/managedHsm/keys/sign/action" ],
}
]
}
},
"api-version": "7.2-preview"
},
"responses": {
"201": {
"body": {
"properties": {
"roleName": "My custom role",
"type": "CustomRole",
"description": "Role description",
"assignableScopes": [
"/"
],
"permissions": [
{
"dataActions": [ "Microsoft.KeyVault/managedHsm/keys/sign/action" ],
}
]
},
"id": "Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/00000000-0000-0000-0000-000000000000",
"type": "Microsoft.Authorization/roleDefinitions",
"name": "00000000-0000-0000-0000-000000000000"
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,155 @@
"application/json"
],
"paths": {
"/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}": {
"delete": {
"tags": [
"RoleDefinitions"
],
"operationId": "RoleDefinitions_Delete",
"description": "Deletes a custom role definition.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: should an error be expected if someone tries to delete a built-in role definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

"parameters": [
{
"name": "scope",
"in": "path",
"required": true,
"type": "string",
"description": "The scope of the role definition to delete. Managed HSM only supports '/'.",
"x-ms-skip-url-encoding": true
},
{
"name": "roleDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name (GUID) of the role definition to delete."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns information about the role definition that was deleted.",
"schema": {
"$ref": "#/definitions/RoleDefinition"
}
},
"default": {
"description": "Key Vault error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/KeyVaultError"
}
}
},
"x-ms-examples": {
"DeleteRoleDefinition": {
"$ref": "./examples/DeleteRoleDefinition-example.json"
}
}
},
"put": {
"tags": [
"RoleDefinitions"
],
"operationId": "RoleDefinitions_CreateOrUpdate",
"description": "Creates or updates a custom role definition.",
"parameters": [
{
"name": "scope",
"in": "path",
"required": true,
"type": "string",
"description": "The scope of the role definition to create or update. Managed HSM only supports '/'.",
"x-ms-skip-url-encoding": true
},
{
"name": "roleDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the role definition to create or update. It can be any valid GUID."
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/RoleDefinitionCreateParameters"
},
"description": "Parameters for the role definition."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"201": {
"description": "Created - Returns information about the role definition.",
"schema": {
"$ref": "#/definitions/RoleDefinition"
}
},
"default": {
"description": "Key Vault error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/KeyVaultError"
}
}
},
"x-ms-examples": {
"PutRoleDefinition": {
"$ref": "./examples/PutRoleDefinition-example.json"
}
}
},
"get": {
"tags": [
"RoleDefinitions"
],
"operationId": "RoleDefinitions_Get",
"description": "Get the specified role definition.",
"parameters": [
{
"name": "scope",
"in": "path",
"required": true,
"type": "string",
"description": "The scope of the role definition to get. Managed HSM only supports '/'.",
"x-ms-skip-url-encoding": true
},
{
"name": "roleDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the role definition to get."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns information about the role definition.",
"schema": {
"$ref": "#/definitions/RoleDefinition"
}
},
"default": {
"description": "Key Vault error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/KeyVaultError"
}
}
},
"x-ms-examples": {
"GetRoleAssignments": {
"$ref": "./examples/GetRoleDefinition-example.json"
}
}
}
},
"/{scope}/providers/Microsoft.Authorization/roleDefinitions": {
"get": {
"tags": [
Expand Down Expand Up @@ -365,6 +514,18 @@
],
"description": "Role assignment properties."
},
"RoleDefinitionCreateParameters": {
"properties": {
"properties": {
"$ref": "#/definitions/RoleDefinitionProperties",
"description": "Role definition properties."
}
},
"required": [
"properties"
],
"description": "Role assignment create parameters."
},
"RoleAssignmentCreateParameters": {
"properties": {
"properties": {
Expand Down Expand Up @@ -502,4 +663,4 @@
"description": "Client API version."
}
}
}
}