Azure setup scripts
Some features of EasyLife 365 keep data in a resource in your own Azure subscription. You create the resource and give access yourself, with the scripts on this page. EasyLife 365 Admin Insiders fills in the command for you, and you can read every script before you run it.
How the scripts work
- You run them, in your subscription. EasyLife 365 never creates anything in your subscription and never assigns a role there.
- Parameters only. A script takes the names, the region and the application (client) ID of the product's app as parameters, and reads nothing else.
- Safe to run again. A second run changes nothing: it lists what exists already as skipped. A script never changes the settings of an existing resource and never deletes anything.
- Versioned. Each use case has a version folder, such as
v1. A published version never changes. A fix comes as a new version, and the older one stays. - Two ways to run each script: PowerShell (
.ps1, with the Az modules) or Bash with the Azure CLI (.sh). Azure Cloud Shell has both. - The product's app is shown by name before any change, with its application ID and service principal, so you can check it's the right app.
Which file to run
| File | When to run it |
|---|---|
create.ps1, create.sh | You have nothing yet. It creates the resource and gives the product's app its role in one run |
grant.ps1, grant.sh | The resource exists already, or you created it another way. It only gives the product's app its role |
template.json (Deploy to Azure), with its source template.bicep | You prefer the Azure portal for a new resource. It creates the resource only, so run grant after it |
manifest.json | Not run. It lists the parameters, the role, the scope and what each file creates |
Each use case below says exactly what each file creates, changes and never does.
Who may connect a resource
The person who runs grant, or who finishes Connect and test in the Admin Portal, must be able to give access on the resource. That takes one of these Azure roles on the resource or above it:
- Owner
- User Access Administrator
- Role Based Access Control Administrator
These roles hold Microsoft.Authorization/roleAssignments/write. Contributor, Reader and the data roles aren't enough. If your role is eligible in Privileged Identity Management (PIM), activate it first. To run create, you also need to create resources in the subscription, for example as Owner, or as Contributor together with User Access Administrator or Role Based Access Control Administrator. To deploy a template, Contributor on the resource group is enough.
Before the first test, the Admin Portal asks for one Azure permission on your behalf. See The Azure permission of Connect and test.
Parameters
The commands in the Admin Portal fill these in. In Bash, the names are lowercase with hyphens: --account-name, --app-id and so on. Every name is checked against the Azure name rules before anything is sent to Azure.
| Parameter | Used by | Meaning |
|---|---|---|
-AccountName, -ContainerName | guest documents storage, Safe sharing storage | The storage account and the container |
-VaultName, -SecretName | credential renewal: secret | The key vault and the secret |
-VaultName, -CertificateName | credential renewal: certificate | The key vault and the certificate |
-WorkspaceName | audit workspace | The Log Analytics workspace |
-Region | create | The Azure region of a new resource, for example westeurope |
-AppId | all scripts | The application (client) ID of the product's app in your tenant. The role goes to its service principal |
-ResourceGroupName | create; the audit workspace grant | Optional. The resource group of a new resource, default rg-easylife365. For the audit workspace, the resource group of the workspace you mean, needed when the name exists more than once |
-Subscription | all scripts | Optional. The subscription. Default: the current one. In Bash it also becomes your default subscription in the Azure CLI |
-Yes | create; the audit workspace grant | Optional. Uses the current subscription without asking. Without -Subscription or -Yes, these scripts show the current subscription and ask you to confirm it |
Key vaults use Azure role-based access control
EasyLife 365 works with key vaults that use Azure role-based access control. A vault that uses access policies isn't supported: the scripts stop on such a vault with a message and change nothing on it. You can switch the vault's permission model under Access configuration in the Azure portal, but check first who else uses the vault: after the switch, its access policies stop working for every other app and person, and they need roles instead. Often a separate vault for EasyLife 365 is simpler. The create scripts and the template create a vault with Azure role-based access control.
Guest documents storage
EasyLife 365 Collaboration Insiders keeps the documents your guests sign in a container of your storage account. The EasyLife 365 Collaboration Insiders app gets Storage Blob Data Contributor on the container only.
| File | Creates or changes | Never does |
|---|---|---|
create | A resource group, when the account and the group don't exist yet. A storage account that accepts only Microsoft Entra ID sign-in (no account keys), only HTTPS with TLS 1.2 or higher, and no anonymous access, and that never copies data to another tenant. Its data is kept in one Azure region (locally redundant). The container, with no anonymous access. The role on the container | Change an existing account or container, delete anything |
grant | The role on the container. It stops when the account or the container is missing | Create a resource, change a setting, delete anything |
template.json | The storage account and the container, as create does. Deployed over an existing account, it sets that account's settings back to the ones above: it turns off account keys and anonymous access, which can cut off other apps that use the account, and makes the account locally redundant, which drops a copy in a second region | Assign a role |
Files of version v1:
create.ps1,create.shgrant.ps1,grant.shtemplate.json,template.bicep, Deploy to Azuremanifest.json
./create.ps1 -AccountName contosoguests -ContainerName guest-documents -Region westeurope -AppId <application-id>
Safe sharing storage
EasyLife 365 Identity Insiders keeps the files of Safe sharing in a container of your storage account. The EasyLife 365 Identity Insiders app gets Storage Blob Data Contributor on the container only.
| File | Creates or changes | Never does |
|---|---|---|
create | A resource group, when the account and the group don't exist yet. A storage account with the same settings as for guest documents. The container, with no anonymous access. The role on the container | Change an existing account or container, delete anything |
grant | The role on the container. It stops when the account or the container is missing | Create a resource, change a setting, delete anything |
template.json | The storage account and the container, as create does. Deployed over an existing account, it sets that account's settings back, as for guest documents: it turns off account keys and anonymous access, which can cut off other apps, and makes the account locally redundant | Assign a role |
Files of version v1:
create.ps1,create.shgrant.ps1,grant.shtemplate.json,template.bicep, Deploy to Azuremanifest.json
Credential renewal: secret
EasyLife 365 Identity Insiders writes a renewed client secret into a secret of your key vault. The EasyLife 365 Identity Insiders app gets Key Vault Secrets Officer on that secret only.
| File | Creates or changes | Never does |
|---|---|---|
create | A resource group, when the vault and the group don't exist yet. A key vault: standard tier, Azure role-based access control, soft delete kept 90 days. The secret, with a random first value that goes straight into the vault and that nobody sees. The role on the secret | Change an existing vault, overwrite an existing secret, read a secret's value, delete anything. It stops on a vault that uses access policies |
grant | The role on the secret. It stops when the vault uses access policies, or when the vault or the secret is missing | Create a resource, read a secret's value, change a setting, delete anything |
template.json | The key vault and the secret, with a random value. Deployed again or over an existing vault, it overwrites more: see the warning below | Assign a role |
The scripts create the secret and check that it exists through Azure Resource Manager, and never read its value, so you don't need a Key Vault data role to run them.
A secret name may start with a hyphen, and the scripts read it as a name. In PowerShell, put such a name in quotes to be safe, for example -SecretName '-S': PowerShell itself reads an unquoted -S as a parameter.
Deploy the template once, for a new vault. Deployed again, or over a vault that exists already, it writes a new random value into the secret, over the credential that EasyLife 365 Identity Insiders renewed. On a vault that uses access policies, it also switches the vault to Azure role-based access control and removes its access policies, which can cut off every other app and person that uses the vault, and it can set other vault settings back, such as its network rules. The scripts do none of this: they stop on a vault with access policies and keep an existing secret as it is. For an existing vault, use the scripts.
Files of version v1:
create.ps1,create.shgrant.ps1,grant.shtemplate.json,template.bicep, Deploy to Azuremanifest.json
Credential renewal: certificate
EasyLife 365 Identity Insiders renews a certificate of an app registration in your key vault. The EasyLife 365 Identity Insiders app gets Key Vault Certificates Officer on the key vault, so the role covers every certificate in it: the app can do anything with any of them, including deleting one for good, and can manage the vault's certificate issuers. Use a vault that holds only the certificates EasyLife 365 Identity Insiders renews. The certificate's own settings in Key Vault, such as its validity and key type, stay yours.
| File | Creates or changes | Never does |
|---|---|---|
grant | The role on the vault. It stops when the vault uses access policies or is missing. It checks the format of the certificate name and shows it, but the role covers the whole vault | Create a vault or a certificate, change a setting, delete anything |
There is no create script and no template for this use case: create the vault, with Azure role-based access control, and the certificate yourself, then run grant.
Files of version v1:
Audit workspace
EasyLife 365 Collaboration Insiders, EasyLife 365 Identity Insiders and EasyLife 365 Mail Insiders can keep the audit log in a Log Analytics workspace of yours, and they can share one. Each product has its own app, and each app gets Log Analytics Reader on the workspace only. create gives the role to the app whose application ID you pass. Run grant once with the application ID of each other product that reads the workspace.
The role lets the app read all data in the workspace, every table, not only the audit log. Use a workspace that holds only EasyLife 365 data, or one whose other data you're fine to share with it.
| File | Creates or changes | Never does |
|---|---|---|
create | A resource group, when the workspace and the group don't exist yet. A Log Analytics workspace: pay-as-you-go pricing, data kept 30 days. The role on the workspace. It asks for -ResourceGroupName when the name exists more than once | Change an existing workspace, delete anything |
grant | The role on the workspace. It asks you to confirm the subscription, because workspace names are unique only within a resource group, and asks for -ResourceGroupName when the name exists more than once | Create a resource, change a setting, delete anything |
template.json | The workspace, as create does. Deployed over an existing workspace, it sets the pricing tier back and the workspace's default retention to 30 days, which deletes older data of every table that uses that default | Assign a role |
Files of version v1:
create.ps1,create.shgrant.ps1,grant.shtemplate.json,template.bicep, Deploy to Azuremanifest.json
bash ./grant.sh --workspace-name contoso-audit --app-id <application-id>