Skip to content

Commit

Permalink
AZ-104 Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
bob-fornal committed Jun 15, 2024
1 parent 3afdfe7 commit 36641e1
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cloud/Azure/AZ-104--Administrator/ms-learn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
## Prerequisites for Azure Administrators

* [Use Azure Resource Manager](./prerequisites-for-azure-admin--01-use-azure-resource-manager.md)
* [Introduction to Azure Cloud Shell](./prerequisites-for-azure-admin--02-intro-to-azure-cloud-shell.md)
* [Introduction to Bash](./prerequisites-for-azure-admin--03-intro-to-bash.md)
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,80 @@ The following suggestions help you take full advantage of Azure Resource Manager

Each resource provider offers a set of resources and operations for working with an Azure service. For example, if you want to store keys and secrets, you work with the Microsoft.KeyVault resource provider. This resource provider offers a resource type called vaults for creating the key vault.

The name of a resource type is in the format: {resource-provider}/{resource-type}. For example, the key vault type is Microsoft.KeyVault/vaults.
The name of a resource type is in the format: `{resource-provider}/{resource-type}`. For example, the key vault type is `Microsoft.KeyVault/vaults`.

## Creating Resource Groups

Resources can be deployed to any new or existing resource group. Deployment of resources to a resource group becomes a job where you can track the template execution. If deployment fails, the output of the job can describe why the deployment failed. Whether the deployment is a single resource to a group or a template to a group, you can use the information to fix any errors and redeploy. Deployments are incremental; if a resource group contains two web apps and you decide to deploy a third, the existing web apps will not be removed.

### Considerations

Resource Groups are at their simplest a logical collection of resources. There are a few rules for resource groups.

* Resources can only exist in one resource group.
* Resource Groups cannot be renamed.
* Resource Groups can have resources of many different types (services).
* Resource Groups can have resources from many different regions.

### Creating resource groups

There are some important factors to consider when defining your resource group:

* All the resources in your group should share the same lifecycle. You deploy, update, and delete them together. If one resource, such as a database server, needs to exist on a different deployment cycle it should be in another resource group.
* Each resource can only exist in one resource group.
* You can add or remove a resource to a resource group at any time.
* You can move a resource from one resource group to another group. Limitations do apply to moving resources.
* A resource group can contain resources that reside in different regions.
* A resource group can be used to scope access control for administrative actions.
* A resource can interact with resources in other resource groups. This interaction is common when the two resources are related but don't share the same lifecycle (for example, web apps connecting to a database).

When creating a resource group, you need to provide a location for that resource group. You may be wondering, "Why does a resource group need a location? And, if the resources can have different locations than the resource group, why does the resource group location matter at all?" The resource group stores metadata about the resources. Therefore, when you specify a location for the resource group, you're specifying where that metadata is stored. For compliance reasons, you may need to ensure that your data is stored in a particular region.

### Crating Resource Manager Locks

A common concern with resources provisioned in Azure is the ease with which they can be deleted. An over-zealous or careless administrator can accidentally erase months of work with a few steps. Resource Manager locks allow organizations to put a structure in place that prevents the accidental deletion of resources in Azure.

* You can associate the lock with a subscription, resource group, or resource.
* Locks are inherited by child resources.

#### Lock types

There are two types of resource locks.

* Read-Only locks, which prevent any changes to the resource.
* Delete locks, which prevent deletion.

## Reorganize Azure Resources

When moving resources, both the source group and the target group are locked during the operation. Write and delete operations are blocked on the resource groups until the move completes. This lock means you can't add, update, or delete resources in the resource groups. Locks don't mean the resources aren't available. For example, if you move a virtual machine to a new resource group, an application can still access the virtual machine.

### Limitations

Before beginning this process be sure to read the Move operation support for resources page. This page details what resources can be moved between resources group, subscriptions, and regions.

### Implementation

To move resources, select the resource group containing those resources, and then select the Move button. Select the resources to move and the destination resource group. Acknowledge that you need to update scripts.

## Remove Resources and Resource Groups

Use caution when deleting a resource group. Deleting a resource group deletes all the resources contained within it. That resource group might contain resources that resources in other resource groups depend on.

### Using PowerShell to delete resource groups

To remove a resource group use, `Remove-AzResourceGroup`. In this example, we are removing the `ContosoRG01` resource group from the subscription. The cmdlet prompts you for confirmation and returns no output.

```powershell
Remove-AzResourceGroup -Name "ContosoRG01"
```

### Removing resources

You can also delete individual resources within a resource group. For example, here we are deleting a virtual network. Instead, of deleting you can move the resource to another resource group.

## Determine Resource Limits

* The limits shown are the limits for your subscription.
* When you need to increase a default limit, there is a Request Increase link.
* All resources have a maximum limit listed in Azure limits.
* If you are at the maximum limit, the limit can't be increased.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Introduction to Azure Cloud Shell

Azure Cloud Shell is a browser-accessible command-line experience for managing Azure resources. It provides the flexibility of choosing the shell experience that best suits the way you work, either Bash or PowerShell. Traditionally, to interact with Azure resources via command-line, you need to install the necessary components into your local computer (PC, Mac, Linux). With Cloud Shell, you have an authenticated, interactive shell that isn't part of a local machine.

## What is Azure Cloud Shell?

Azure Cloud Shell is a command-line environment you can access through your web browser. You can use this environment to manage Azure resources, including VMs, storage, and networking. Just like you do when using the Azure CLI or Azure PowerShell.

Because Microsoft manages Cloud Shell, you always have access to the most recent versions of the Azure CLI and PowerShell modules right from any browser. You don't have to worry about keeping modules up to date. With Cloud Shell, you just open your browser and sign in. Just like that, you have access to a command-line environment fully connected with your account's permissions and the resources to which you have access. All that works in an infrastructure that's compliant with double encryption at rest by default. You don't need to take any further action!

Azure Cloud Shell also provides cloud storage to persist files such as SSH keys, scripts, and more. This functionality lets you access important files in between sessions and with different machines. Finally, you can use the Cloud Shell editor to make changes to files, such as scripts, that are saved into this cloud storage directly from the Cloud Shell interface.

## How does Azure Cloud Shell work?

You have a few different options for accessing Azure Cloud Shell:

* From a direct link.
* From the Azure portal.
* A screenshot of Cloud Shell accessed from Azure portal.

When you open a Cloud Shell session, a temporary host is allocated to your session. This VM is preconfigured with the latest versions of PowerShell and Bash. You can then select the command-line experience you want to use:

* PowerShell
* Bash

Cloud Shell sessions terminate after 20 minutes of inactivity. When a session terminates, files on your CloudDrive are persisted, but you need to start a new session to access the Cloud Shell environment.

### Access your own scripts and files

When using Cloud Shell, you might also need to run scripts or use files for different actions. You can persist files on Cloud Shell by using the Azure CloudDrive.

After uploading files, you can interact with them as you would in a regular PowerShell or Bash session.

Now that your file resides on CloudDrive, you can close the session and open another session on a different device and still access the same file. Cloud Shell also lets you map an Azure Storage File Share, which is tied to a specific region. Access to an Azure File Share lets you work with the contents of that share through Cloud Shell.

If you need to edit scripts hosted on the CloudDrive or File Share, you can use the Cloud Shell editor.

### Cloud Shell tools

If you need to manage resources (such as Docker containers or Kubernetes Clusters) or want to use non-Microsoft tools (such as Ansible and Terraform) in Cloud Shell, the Cloud Shell session comes with these add-ons already preconfigured.

## When should you use Azure Cloud Shell?

You can use Azure Cloud Shell to:

* Open a secure command-line session from any browser-based device.
* Interact with Azure resources without the need to install plug-ins or add-ons to your device.
* Persist files between sessions for later use.
* Use either Bash or PowerShell, whichever you prefer, to manage Azure resources.
* Edit files (such as scripts) via the Cloud Shell editor.

You shouldn't use Azure Cloud Shell if:

* You intend to leave a session open for more than 20 minutes for long running scripts or activities. In these cases, your session is disconnected without warning, and the current state is lost.
* You need admin permissions, such as sudo access, from within the Azure CLI or PowerShell environment.
* You need to install tools that aren't supported in the limited Cloud Shell environment, but instead require an environment such as a custom virtual machine or container.
* You need storage from different regions. You might need to back up and synchronize this content since only one region can have the storage allocated to Azure Cloud Shell.
* You need to open multiple sessions at the same time. Azure Cloud Shell allows only one instance at time and isn't suitable for concurrent work across multiple subscriptions or tenants.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Introduction to Bash

Bash is a vital tool for managing Linux machines. The name is short for "Bourne Again Shell."

A shell is a program that commands the operating system to perform actions. You can enter commands in a console on your computer and run the commands directly, or you can use scripts to run batches of commands. Shells like PowerShell and Bash give system administrators the power and precision they need for fine-tuned control of the computers they're responsible for.

There are other Linux shells, including csh and zsh, but Bash has become the de facto Linux standard. That's because Bash is compatible with Unix's first serious shell, the Bourne shell, also known as sh. Bash incorporates the best features of its predecessors. But Bash also has some fine features of its own, including built-in commands and the ability to invoke external programs.

One reason for Bash's success is its simplicity. Bash, like the rest of Linux, is based on the Unix design philosophy. As Peter Salus summarized in his book A Quarter Century of Unix, three of the "big ideas" embodied in Unix are:

* Programs do one thing and do it well
* Programs work together
* Programs use text streams as the universal interface

The last part is key to understanding how Bash works. In Unix and Linux, everything is a file. That means you can use the same commands without worrying about whether the I/O stream — the input and output — comes from a keyboard, a disk file, a socket, a pipe, or another I/O abstraction.

## Bash Fundamentals

The full syntax for a Bash command is:

```bash
command [options] [arguments]
```

Bash treats the first string it encounters as a command.

### Get help

Which options and arguments can be used, or must be used, varies from command to command. Fortunately, Bash documentation is built into the operating system. Help is never more than a command away. To learn about the options for a command, use the `man` (for "manual") command. For instance, to see all the options for the `mkdir` ("make directory") command, do this:

```bash
man mkdir
```

`man` will be your best friend as you learn Bash. `man` is how you find the information you need to understand how any command works.

### Use wildcards

Wildcards are symbols that represent one or more characters in Bash commands. The most frequently used wildcard is the asterisk. It represents zero characters or a sequence of characters. Suppose your current directory contains hundreds of image files, but you only want to see the PNG files; the ones whose file names end with .png. Here's the command to list only those files:

```bash
ls *.png
```

0 comments on commit 36641e1

Please sign in to comment.